diff --git a/.bundle/bin/coderay b/.bundle/bin/coderay new file mode 100755 index 0000000..08d501f --- /dev/null +++ b/.bundle/bin/coderay @@ -0,0 +1,23 @@ +#!/usr/bin/env ruby +# +# This file was generated by RubyGems. +# +# The application 'coderay' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require 'rubygems' + +version = ">= 0" + +if ARGV.first + str = ARGV.first + str = str.dup.force_encoding("BINARY") if str.respond_to? :force_encoding + if str =~ /\A_(.*)_\z/ and Gem::Version.correct?($1) then + version = $1 + ARGV.shift + end +end + +gem 'coderay', version +load Gem.bin_path('coderay', 'coderay', version) diff --git a/.bundle/bin/htmldiff b/.bundle/bin/htmldiff new file mode 100755 index 0000000..b39c99d --- /dev/null +++ b/.bundle/bin/htmldiff @@ -0,0 +1,25 @@ +#!/bin/sh +'exec' "ruby" '-x' "$0" "$@" +#!/usr/local/opt/rbenv/versions/2.1.5/bin/ruby +# +# This file was generated by RubyGems. +# +# The application 'diff-lcs' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require 'rubygems' + +version = ">= 0" + +if ARGV.first + str = ARGV.first + str = str.dup.force_encoding("BINARY") if str.respond_to? :force_encoding + if str =~ /\A_(.*)_\z/ and Gem::Version.correct?($1) then + version = $1 + ARGV.shift + end +end + +gem 'diff-lcs', version +load Gem.bin_path('diff-lcs', 'htmldiff', version) diff --git a/.bundle/bin/ldiff b/.bundle/bin/ldiff new file mode 100755 index 0000000..1da6891 --- /dev/null +++ b/.bundle/bin/ldiff @@ -0,0 +1,25 @@ +#!/bin/sh +'exec' "ruby" '-x' "$0" "$@" +#!/usr/local/opt/rbenv/versions/2.1.5/bin/ruby +# +# This file was generated by RubyGems. +# +# The application 'diff-lcs' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require 'rubygems' + +version = ">= 0" + +if ARGV.first + str = ARGV.first + str = str.dup.force_encoding("BINARY") if str.respond_to? :force_encoding + if str =~ /\A_(.*)_\z/ and Gem::Version.correct?($1) then + version = $1 + ARGV.shift + end +end + +gem 'diff-lcs', version +load Gem.bin_path('diff-lcs', 'ldiff', version) diff --git a/.bundle/bin/pry b/.bundle/bin/pry new file mode 100755 index 0000000..27a22a8 --- /dev/null +++ b/.bundle/bin/pry @@ -0,0 +1,23 @@ +#!/usr/bin/env ruby +# +# This file was generated by RubyGems. +# +# The application 'pry' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require 'rubygems' + +version = ">= 0" + +if ARGV.first + str = ARGV.first + str = str.dup.force_encoding("BINARY") if str.respond_to? :force_encoding + if str =~ /\A_(.*)_\z/ and Gem::Version.correct?($1) then + version = $1 + ARGV.shift + end +end + +gem 'pry', version +load Gem.bin_path('pry', 'pry', version) diff --git a/.bundle/bin/rspec b/.bundle/bin/rspec new file mode 100755 index 0000000..1df29e9 --- /dev/null +++ b/.bundle/bin/rspec @@ -0,0 +1,23 @@ +#!/usr/bin/env ruby +# +# This file was generated by RubyGems. +# +# The application 'rspec-core' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require 'rubygems' + +version = ">= 0" + +if ARGV.first + str = ARGV.first + str = str.dup.force_encoding("BINARY") if str.respond_to? :force_encoding + if str =~ /\A_(.*)_\z/ and Gem::Version.correct?($1) then + version = $1 + ARGV.shift + end +end + +gem 'rspec-core', version +load Gem.bin_path('rspec-core', 'rspec', version) diff --git a/.bundle/binstubs/coderay b/.bundle/binstubs/coderay new file mode 100755 index 0000000..8cf9c60 --- /dev/null +++ b/.bundle/binstubs/coderay @@ -0,0 +1,16 @@ +#!/usr/bin/env ruby +# +# This file was generated by Bundler. +# +# The application 'coderay' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../../Gemfile", + Pathname.new(__FILE__).realpath) + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("coderay", "coderay") diff --git a/.bundle/binstubs/htmldiff b/.bundle/binstubs/htmldiff new file mode 100755 index 0000000..0fd2462 --- /dev/null +++ b/.bundle/binstubs/htmldiff @@ -0,0 +1,16 @@ +#!/usr/bin/env ruby +# +# This file was generated by Bundler. +# +# The application 'htmldiff' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../../Gemfile", + Pathname.new(__FILE__).realpath) + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("diff-lcs", "htmldiff") diff --git a/.bundle/binstubs/ldiff b/.bundle/binstubs/ldiff new file mode 100755 index 0000000..4155bee --- /dev/null +++ b/.bundle/binstubs/ldiff @@ -0,0 +1,16 @@ +#!/usr/bin/env ruby +# +# This file was generated by Bundler. +# +# The application 'ldiff' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../../Gemfile", + Pathname.new(__FILE__).realpath) + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("diff-lcs", "ldiff") diff --git a/.bundle/binstubs/pry b/.bundle/binstubs/pry new file mode 100755 index 0000000..1f13a77 --- /dev/null +++ b/.bundle/binstubs/pry @@ -0,0 +1,16 @@ +#!/usr/bin/env ruby +# +# This file was generated by Bundler. +# +# The application 'pry' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../../Gemfile", + Pathname.new(__FILE__).realpath) + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("pry", "pry") diff --git a/.bundle/binstubs/rspec b/.bundle/binstubs/rspec new file mode 100755 index 0000000..0a3c82e --- /dev/null +++ b/.bundle/binstubs/rspec @@ -0,0 +1,16 @@ +#!/usr/bin/env ruby +# +# This file was generated by Bundler. +# +# The application 'rspec' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require "pathname" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../../Gemfile", + Pathname.new(__FILE__).realpath) + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("rspec-core", "rspec") diff --git a/.bundle/cache/coderay-1.1.0.gem b/.bundle/cache/coderay-1.1.0.gem new file mode 100644 index 0000000..20f2911 Binary files /dev/null and b/.bundle/cache/coderay-1.1.0.gem differ diff --git a/.bundle/cache/diff-lcs-1.2.5.gem b/.bundle/cache/diff-lcs-1.2.5.gem new file mode 100644 index 0000000..e4436cc Binary files /dev/null and b/.bundle/cache/diff-lcs-1.2.5.gem differ diff --git a/.bundle/cache/method_source-0.8.2.gem b/.bundle/cache/method_source-0.8.2.gem new file mode 100644 index 0000000..842453a Binary files /dev/null and b/.bundle/cache/method_source-0.8.2.gem differ diff --git a/.bundle/cache/pry-0.10.1.gem b/.bundle/cache/pry-0.10.1.gem new file mode 100644 index 0000000..2586875 Binary files /dev/null and b/.bundle/cache/pry-0.10.1.gem differ diff --git a/.bundle/cache/rspec-3.3.0.gem b/.bundle/cache/rspec-3.3.0.gem new file mode 100644 index 0000000..3a9ad2b Binary files /dev/null and b/.bundle/cache/rspec-3.3.0.gem differ diff --git a/.bundle/cache/rspec-core-3.3.2.gem b/.bundle/cache/rspec-core-3.3.2.gem new file mode 100644 index 0000000..978694e Binary files /dev/null and b/.bundle/cache/rspec-core-3.3.2.gem differ diff --git a/.bundle/cache/rspec-expectations-3.3.1.gem b/.bundle/cache/rspec-expectations-3.3.1.gem new file mode 100644 index 0000000..b8ba962 Binary files /dev/null and b/.bundle/cache/rspec-expectations-3.3.1.gem differ diff --git a/.bundle/cache/rspec-mocks-3.3.2.gem b/.bundle/cache/rspec-mocks-3.3.2.gem new file mode 100644 index 0000000..81e6e94 Binary files /dev/null and b/.bundle/cache/rspec-mocks-3.3.2.gem differ diff --git a/.bundle/cache/rspec-support-3.3.0.gem b/.bundle/cache/rspec-support-3.3.0.gem new file mode 100644 index 0000000..9b9e706 Binary files /dev/null and b/.bundle/cache/rspec-support-3.3.0.gem differ diff --git a/.bundle/cache/slop-3.6.0.gem b/.bundle/cache/slop-3.6.0.gem new file mode 100644 index 0000000..153a673 Binary files /dev/null and b/.bundle/cache/slop-3.6.0.gem differ diff --git a/.bundle/config b/.bundle/config new file mode 100644 index 0000000..df11c75 --- /dev/null +++ b/.bundle/config @@ -0,0 +1,2 @@ +--- +BUNDLE_DISABLE_SHARED_GEMS: '1' diff --git a/.bundle/gems/coderay-1.1.0/README_INDEX.rdoc b/.bundle/gems/coderay-1.1.0/README_INDEX.rdoc new file mode 100644 index 0000000..7332653 --- /dev/null +++ b/.bundle/gems/coderay-1.1.0/README_INDEX.rdoc @@ -0,0 +1,123 @@ += CodeRay + +Tired of blue'n'gray? Try the original version of this documentation on +coderay.rubychan.de[http://coderay.rubychan.de/doc/] :-) + +== About + +CodeRay is a Ruby library for syntax highlighting. + +You put your code in, and you get it back colored; Keywords, strings, +floats, comments - all in different colors. And with line numbers. + +*Syntax* *Highlighting*... +* makes code easier to read and maintain +* lets you detect syntax errors faster +* helps you to understand the syntax of a language +* looks nice +* is what everybody wants to have on their website +* solves all your problems and makes the girls run after you + + +== Installation + + % gem install coderay + + +=== Dependencies + +CodeRay needs Ruby 1.8.7+ or 1.9.2+. It also runs on Rubinius and JRuby. + + +== Example Usage + + require 'coderay' + + html = CodeRay.scan("puts 'Hello, world!'", :ruby).div(:line_numbers => :table) + + +== Documentation + +See CodeRay. + + +== Credits + +=== Special Thanks to + +* licenser (Heinz N. Gies) for ending my QBasic career, inventing the Coder + project and the input/output plugin system. + CodeRay would not exist without him. +* bovi (Daniel Bovensiepen) for helping me out on various occasions. + +=== Thanks to + +* Caleb Clausen for writing RubyLexer (see + http://rubyforge.org/projects/rubylexer) and lots of very interesting mail + traffic +* birkenfeld (Georg Brandl) and mitsuhiku (Arnim Ronacher) for PyKleur, now pygments. + You guys rock! +* Jamis Buck for writing Syntax (see http://rubyforge.org/projects/syntax) + I got some useful ideas from it. +* Doug Kearns and everyone else who worked on ruby.vim - it not only helped me + coding CodeRay, but also gave me a wonderful target to reach for the Ruby + scanner. +* everyone who uses CodeBB on http://www.rubyforen.de and http://www.python-forum.de +* iGEL, magichisoka, manveru, WoNáDo and everyone I forgot from rubyforen.de +* Dethix from ruby-mine.de +* zickzackw +* Dookie (who is no longer with us...) and Leonidas from http://www.python-forum.de +* Andreas Schwarz for finding out that CaseIgnoringWordList was not case + ignoring! Such things really make you write tests. +* closure for the first version of the Scheme scanner. +* Stefan Walk for the first version of the JavaScript and PHP scanners. +* Josh Goebel for another version of the JavaScript scanner, a SQL and a Diff scanner. +* Jonathan Younger for pointing out the licence confusion caused by wrong LICENSE file. +* Jeremy Hinegardner for finding the shebang-on-empty-file bug in FileType. +* Charles Oliver Nutter and Yehuda Katz for helping me benchmark CodeRay on JRuby. +* Andreas Neuhaus for pointing out a markup bug in coderay/for_redcloth. +* 0xf30fc7 for the FileType patch concerning Delphi file extensions. +* The folks at redmine.org - thank you for using and fixing CodeRay! +* Keith Pitt for his SQL scanners +* Rob Aldred for the terminal encoder +* Trans for pointing out $DEBUG dependencies +* Flameeyes for finding that Term::ANSIColor was obsolete +* matz and all Ruby gods and gurus +* The inventors of: the computer, the internet, the true color display, HTML & + CSS, VIM, Ruby, pizza, microwaves, guitars, scouting, programming, anime, + manga, coke and green ice tea. + +Where would we be without all those people? + +=== Created using + +* Ruby[http://ruby-lang.org/] +* Chihiro (my Sony VAIO laptop); Henrietta (my old MacBook); + Triella, born Rico (my new MacBook); as well as + Seras and Hikari (my PCs) +* RDE[http://homepage2.nifty.com/sakazuki/rde_e.html], + VIM[http://vim.org] and TextMate[http://macromates.com] +* Subversion[http://subversion.tigris.org/] +* Redmine[http://redmine.org/] +* Firefox[http://www.mozilla.org/products/firefox/], + Firebug[http://getfirebug.com/], Safari[http://www.apple.com/safari/], and + Thunderbird[http://www.mozilla.org/products/thunderbird/] +* RubyGems[http://docs.rubygems.org/] and Rake[http://rake.rubyforge.org/] +* TortoiseSVN[http://tortoisesvn.tigris.org/] using Apache via + XAMPP[http://www.apachefriends.org/en/xampp.html] +* RDoc (though I'm quite unsatisfied with it) +* Microsoft Windows (yes, I confess!) and MacOS X +* GNUWin32, MinGW and some other tools to make the shell under windows a bit + less useless +* Term::ANSIColor[http://term-ansicolor.rubyforge.org/] +* PLEAC[http://pleac.sourceforge.net/] code examples +* Github +* Travis CI (http://travis-ci.org/rubychan/github) + +=== Free + +* As you can see, CodeRay was created under heavy use of *free* software. +* So CodeRay is also *free*. +* If you use CodeRay to create software, think about making this software + *free*, too. +* Thanks :) diff --git a/.bundle/gems/coderay-1.1.0/Rakefile b/.bundle/gems/coderay-1.1.0/Rakefile new file mode 100644 index 0000000..c9b1e8a --- /dev/null +++ b/.bundle/gems/coderay-1.1.0/Rakefile @@ -0,0 +1,37 @@ +require 'bundler/gem_tasks' + +$:.unshift File.dirname(__FILE__) unless $:.include? '.' + +ROOT = '.' +LIB_ROOT = File.join ROOT, 'lib' + +task :default => :test + +if File.directory? 'rake_tasks' + + # load rake tasks from subfolder + for task_file in Dir['rake_tasks/*.rake'].sort + load task_file + end + +else + + # fallback tasks when rake_tasks folder is not present (eg. in the distribution package) + desc 'Run CodeRay tests (basic)' + task :test do + ruby './test/functional/suite.rb' + ruby './test/functional/for_redcloth.rb' + end + + gem 'rdoc' if defined? gem + require 'rdoc/task' + desc 'Generate documentation for CodeRay' + Rake::RDocTask.new :doc do |rd| + rd.title = 'CodeRay Documentation' + rd.main = 'README_INDEX.rdoc' + rd.rdoc_files.add Dir['lib'] + rd.rdoc_files.add rd.main + rd.rdoc_dir = 'doc' + end + +end diff --git a/.bundle/gems/coderay-1.1.0/bin/coderay b/.bundle/gems/coderay-1.1.0/bin/coderay new file mode 100755 index 0000000..889ae72 --- /dev/null +++ b/.bundle/gems/coderay-1.1.0/bin/coderay @@ -0,0 +1,215 @@ +#!/usr/bin/env ruby +require 'coderay' + +$options, args = ARGV.partition { |arg| arg[/^-[hv]$|--\w+/] } +subcommand = args.first if /^\w/ === args.first +subcommand = nil if subcommand && File.exist?(subcommand) +args.delete subcommand + +def option? *options + !($options & options).empty? +end + +def tty? + $stdout.tty? || option?('--tty') +end + +def version + puts <<-USAGE +CodeRay #{CodeRay::VERSION} + USAGE +end + +def help + puts <<-HELP +This is CodeRay #{CodeRay::VERSION}, a syntax highlighting tool for selected languages. + +usage: + coderay [-language] [input] [-format] [output] + +defaults: + language detect from input file name or shebang; fall back to plain text + input STDIN + format detect from output file name or use terminal; fall back to HTML + output STDOUT + +common: + coderay file.rb # highlight file to terminal + coderay file.rb > file.html # highlight file to HTML page + coderay file.rb -div > file.html # highlight file to HTML snippet + +configure output: + coderay file.py output.json # output tokens as JSON + coderay file.py -loc # count lines of code in Python file + +configure input: + coderay -python file # specify the input language + coderay -ruby # take input from STDIN + +more: + coderay stylesheet [style] # print CSS stylesheet + HELP +end + +def commands + puts <<-COMMANDS + general: + highlight code highlighting (default command, optional) + stylesheet print the CSS stylesheet with the given name (aliases: style, css) + + about: + list [of] list all available plugins (or just the scanners|encoders|styles|filetypes) + commands print this list + help show some help + version print CodeRay version + COMMANDS +end + +def print_list_of plugin_host + plugins = plugin_host.all_plugins.map do |plugin| + info = " #{plugin.plugin_id}: #{plugin.title}" + + aliases = (plugin.aliases - [:default]).map { |key| "-#{key}" }.sort_by { |key| key.size } + if plugin.respond_to?(:file_extension) || !aliases.empty? + additional_info = [] + additional_info << aliases.join(', ') unless aliases.empty? + info << " (#{additional_info.join('; ')})" + end + + info << ' <-- default' if plugin.aliases.include? :default + + info + end + puts plugins.sort +end + +if option? '-v', '--version' + version +end + +if option? '-h', '--help' + help +end + +case subcommand +when 'highlight', nil + if ARGV.empty? + version + help + else + signature = args.map { |arg| arg[/^-/] ? '-' : 'f' }.join + names = args.map { |arg| arg.sub(/^-/, '') } + case signature + when /^$/ + exit + when /^ff?$/ + input_file, output_file, = *names + when /^f-f?$/ + input_file, output_format, output_file, = *names + when /^-ff?$/ + input_lang, input_file, output_file, = *names + when /^-f-f?$/ + input_lang, input_file, output_format, output_file, = *names + when /^--?f?$/ + input_lang, output_format, output_file, = *names + else + $stdout = $stderr + help + puts + puts "Unknown parameter order: #{args.join ' '}, expected: [-language] [input] [-format] [output]" + exit 1 + end + + if input_file + input_lang ||= CodeRay::FileType.fetch input_file, :text, true + end + + if output_file + output_format ||= CodeRay::FileType[output_file] || :plain + else + output_format ||= :terminal + end + + output_format = :page if output_format.to_s == 'html' + + if input_file + input = File.read input_file + else + input = $stdin.read + end + + begin + file = + if output_file + File.open output_file, 'w' + else + $stdout + end + CodeRay.encode(input, input_lang, output_format, :out => file) + file.puts + rescue CodeRay::PluginHost::PluginNotFound => boom + $stdout = $stderr + if boom.message[/CodeRay::(\w+)s could not load plugin :?(.*?): /] + puts "I don't know the #$1 \"#$2\"." + else + puts boom.message + end + # puts "I don't know this plugin: #{boom.message[/Could not load plugin (.*?): /, 1]}." + rescue CodeRay::Scanners::Scanner::ScanError + # this is sometimes raised by pagers; ignore + # FIXME: rescue Errno::EPIPE + ensure + file.close if output_file + end + end +when 'li', 'list' + arg = args.first && args.first.downcase + if [nil, 's', 'sc', 'scanner', 'scanners'].include? arg + puts 'input languages (Scanners):' + print_list_of CodeRay::Scanners + end + + if [nil, 'e', 'en', 'enc', 'encoder', 'encoders'].include? arg + puts 'output formats (Encoders):' + print_list_of CodeRay::Encoders + end + + if [nil, 'st', 'style', 'styles'].include? arg + puts 'CSS themes for HTML output (Styles):' + print_list_of CodeRay::Styles + end + + if [nil, 'f', 'ft', 'file', 'filetype', 'filetypes'].include? arg + puts 'recognized file types:' + + filetypes = Hash.new { |h, k| h[k] = [] } + CodeRay::FileType::TypeFromExt.inject filetypes do |types, (ext, type)| + types[type.to_s] << ".#{ext}" + types + end + CodeRay::FileType::TypeFromName.inject filetypes do |types, (name, type)| + types[type.to_s] << name + types + end + + filetypes.sort.each do |type, exts| + puts " #{type}: #{exts.sort_by { |ext| ext.size }.join(', ')}" + end + end +when 'stylesheet', 'style', 'css' + puts CodeRay::Encoders[:html]::CSS.new(args.first || :default).stylesheet +when 'commands' + commands +when 'help' + help +else + $stdout = $stderr + help + puts + if subcommand[/\A\w+\z/] + puts "Unknown command: #{subcommand}" + else + puts "File not found: #{subcommand}" + end + exit 1 +end diff --git a/.bundle/gems/coderay-1.1.0/lib/coderay.rb b/.bundle/gems/coderay-1.1.0/lib/coderay.rb new file mode 100644 index 0000000..f759ed6 --- /dev/null +++ b/.bundle/gems/coderay-1.1.0/lib/coderay.rb @@ -0,0 +1,284 @@ +# encoding: utf-8 +# Encoding.default_internal = 'UTF-8' + +# = CodeRay Library +# +# CodeRay is a Ruby library for syntax highlighting. +# +# I try to make CodeRay easy to use and intuitive, but at the same time fully +# featured, complete, fast and efficient. +# +# See README. +# +# It consists mainly of +# * the main engine: CodeRay (Scanners::Scanner, Tokens, Encoders::Encoder) +# * the plugin system: PluginHost, Plugin +# * the scanners in CodeRay::Scanners +# * the encoders in CodeRay::Encoders +# * the styles in CodeRay::Styles +# +# Here's a fancy graphic to light up this gray docu: +# +# http://cycnus.de/raindark/coderay/scheme.png +# +# == Documentation +# +# See CodeRay, Encoders, Scanners, Tokens. +# +# == Usage +# +# Remember you need RubyGems to use CodeRay, unless you have it in your load +# path. Run Ruby with -rubygems option if required. +# +# === Highlight Ruby code in a string as html +# +# require 'coderay' +# print CodeRay.scan('puts "Hello, world!"', :ruby).html +# +# # prints something like this: +# puts "Hello, world!" +# +# +# === Highlight C code from a file in a html div +# +# require 'coderay' +# print CodeRay.scan(File.read('ruby.h'), :c).div +# print CodeRay.scan_file('ruby.h').html.div +# +# You can include this div in your page. The used CSS styles can be printed with +# +# % coderay_stylesheet +# +# === Highlight without typing too much +# +# If you are one of the hasty (or lazy, or extremely curious) people, just run this file: +# +# % ruby -rubygems /path/to/coderay/coderay.rb > example.html +# +# and look at the file it created in your browser. +# +# = CodeRay Module +# +# The CodeRay module provides convenience methods for the engine. +# +# * The +lang+ and +format+ arguments select Scanner and Encoder to use. These are +# simply lower-case symbols, like :python or :html. +# * All methods take an optional hash as last parameter, +options+, that is send to +# the Encoder / Scanner. +# * Input and language are always sorted in this order: +code+, +lang+. +# (This is in alphabetical order, if you need a mnemonic ;) +# +# You should be able to highlight everything you want just using these methods; +# so there is no need to dive into CodeRay's deep class hierarchy. +# +# The examples in the demo directory demonstrate common cases using this interface. +# +# = Basic Access Ways +# +# Read this to get a general view what CodeRay provides. +# +# == Scanning +# +# Scanning means analysing an input string, splitting it up into Tokens. +# Each Token knows about what type it is: string, comment, class name, etc. +# +# Each +lang+ (language) has its own Scanner; for example, :ruby code is +# handled by CodeRay::Scanners::Ruby. +# +# CodeRay.scan:: Scan a string in a given language into Tokens. +# This is the most common method to use. +# CodeRay.scan_file:: Scan a file and guess the language using FileType. +# +# The Tokens object you get from these methods can encode itself; see Tokens. +# +# == Encoding +# +# Encoding means compiling Tokens into an output. This can be colored HTML or +# LaTeX, a textual statistic or just the number of non-whitespace tokens. +# +# Each Encoder provides output in a specific +format+, so you select Encoders via +# formats like :html or :statistic. +# +# CodeRay.encode:: Scan and encode a string in a given language. +# CodeRay.encode_tokens:: Encode the given tokens. +# CodeRay.encode_file:: Scan a file, guess the language using FileType and encode it. +# +# == All-in-One Encoding +# +# CodeRay.encode:: Highlight a string with a given input and output format. +# +# == Instanciating +# +# You can use an Encoder instance to highlight multiple inputs. This way, the setup +# for this Encoder must only be done once. +# +# CodeRay.encoder:: Create an Encoder instance with format and options. +# CodeRay.scanner:: Create an Scanner instance for lang, with '' as default code. +# +# To make use of CodeRay.scanner, use CodeRay::Scanner::code=. +# +# The scanning methods provide more flexibility; we recommend to use these. +# +# == Reusing Scanners and Encoders +# +# If you want to re-use scanners and encoders (because that is faster), see +# CodeRay::Duo for the most convenient (and recommended) interface. +module CodeRay + + $CODERAY_DEBUG ||= false + + CODERAY_PATH = File.expand_path('../coderay', __FILE__) + + # Assuming the path is a subpath of lib/coderay/ + def self.coderay_path *path + File.join CODERAY_PATH, *path + end + + require 'coderay/version' + + # helpers + autoload :FileType, coderay_path('helpers', 'file_type') + + # Tokens + autoload :Tokens, coderay_path('tokens') + autoload :TokensProxy, coderay_path('tokens_proxy') + autoload :TokenKinds, coderay_path('token_kinds') + + # Plugin system + autoload :PluginHost, coderay_path('helpers', 'plugin') + autoload :Plugin, coderay_path('helpers', 'plugin') + + # Plugins + autoload :Scanners, coderay_path('scanner') + autoload :Encoders, coderay_path('encoder') + autoload :Styles, coderay_path('style') + + # convenience access and reusable Encoder/Scanner pair + autoload :Duo, coderay_path('duo') + + class << self + + # Scans the given +code+ (a String) with the Scanner for +lang+. + # + # This is a simple way to use CodeRay. Example: + # require 'coderay' + # page = CodeRay.scan("puts 'Hello, world!'", :ruby).html + # + # See also demo/demo_simple. + def scan code, lang, options = {}, &block + TokensProxy.new code, lang, options, block + end + + # Scans +filename+ (a path to a code file) with the Scanner for +lang+. + # + # If +lang+ is :auto or omitted, the CodeRay::FileType module is used to + # determine it. If it cannot find out what type it is, it uses + # CodeRay::Scanners::Text. + # + # Calls CodeRay.scan. + # + # Example: + # require 'coderay' + # page = CodeRay.scan_file('some_c_code.c').html + def scan_file filename, lang = :auto, options = {}, &block + lang = FileType.fetch filename, :text, true if lang == :auto + code = File.read filename + scan code, lang, options, &block + end + + # Encode a string. + # + # This scans +code+ with the the Scanner for +lang+ and then + # encodes it with the Encoder for +format+. + # +options+ will be passed to the Encoder. + # + # See CodeRay::Encoder.encode. + def encode code, lang, format, options = {} + encoder(format, options).encode code, lang, options + end + + # Encode pre-scanned Tokens. + # Use this together with CodeRay.scan: + # + # require 'coderay' + # + # # Highlight a short Ruby code example in a HTML span + # tokens = CodeRay.scan '1 + 2', :ruby + # puts CodeRay.encode_tokens(tokens, :span) + # + def encode_tokens tokens, format, options = {} + encoder(format, options).encode_tokens tokens, options + end + + # Encodes +filename+ (a path to a code file) with the Scanner for +lang+. + # + # See CodeRay.scan_file. + # Notice that the second argument is the output +format+, not the input language. + # + # Example: + # require 'coderay' + # page = CodeRay.encode_file 'some_c_code.c', :html + def encode_file filename, format, options = {} + tokens = scan_file filename, :auto, get_scanner_options(options) + encode_tokens tokens, format, options + end + + # Highlight a string into a HTML
<%CONTENT%>
<%LINE_NUMBERS%> |
+ <%CONTENT%> |
+
#{opts[:text]}
"
+ end
+ end
+ def bc_open(opts) # :nodoc:
+ opts[:block] = true
+ @in_bc = opts
+ opts[:lang] ? '' : "" + end + def bc_close(opts) # :nodoc: + opts = @in_bc + @in_bc = nil + opts[:lang] ? '' : "\n" + end + def escape_pre(text) # :nodoc: + if @in_bc ||= nil + text + else + html_esc(text, :html_escape_preformatted) + end + end + end + end + + module TextileDoc # :nodoc: + attr_accessor :filter_coderay + end + + end + +end + +CodeRay::ForRedCloth.install \ No newline at end of file diff --git a/.bundle/gems/coderay-1.1.0/lib/coderay/helpers/file_type.rb b/.bundle/gems/coderay-1.1.0/lib/coderay/helpers/file_type.rb new file mode 100644 index 0000000..7de34d5 --- /dev/null +++ b/.bundle/gems/coderay-1.1.0/lib/coderay/helpers/file_type.rb @@ -0,0 +1,151 @@ +module CodeRay + + # = FileType + # + # A simple filetype recognizer. + # + # == Usage + # + # # determine the type of the given + # lang = FileType[file_name] + # + # # return :text if the file type is unknown + # lang = FileType.fetch file_name, :text + # + # # try the shebang line, too + # lang = FileType.fetch file_name, :text, true + module FileType + + UnknownFileType = Class.new Exception + + class << self + + # Try to determine the file type of the file. + # + # +filename+ is a relative or absolute path to a file. + # + # The file itself is only accessed when +read_shebang+ is set to true. + # That means you can get filetypes from files that don't exist. + def [] filename, read_shebang = false + name = File.basename filename + ext = File.extname(name).sub(/^\./, '') # from last dot, delete the leading dot + ext2 = filename.to_s[/\.(.*)/, 1] # from first dot + + type = + TypeFromExt[ext] || + TypeFromExt[ext.downcase] || + (TypeFromExt[ext2] if ext2) || + (TypeFromExt[ext2.downcase] if ext2) || + TypeFromName[name] || + TypeFromName[name.downcase] + type ||= type_from_shebang(filename) if read_shebang + + type + end + + # This works like Hash#fetch. + # + # If the filetype cannot be found, the +default+ value + # is returned. + def fetch filename, default = nil, read_shebang = false + if default && block_given? + warn 'Block supersedes default value argument; use either.' + end + + if type = self[filename, read_shebang] + type + else + return yield if block_given? + return default if default + raise UnknownFileType, 'Could not determine type of %p.' % filename + end + end + + protected + + def type_from_shebang filename + return unless File.exist? filename + File.open filename, 'r' do |f| + if first_line = f.gets + if type = first_line[TypeFromShebang] + type.to_sym + end + end + end + end + + end + + TypeFromExt = { + 'c' => :c, + 'cfc' => :xml, + 'cfm' => :xml, + 'clj' => :clojure, + 'css' => :css, + 'diff' => :diff, + 'dpr' => :delphi, + 'erb' => :erb, + 'gemspec' => :ruby, + 'go' => :go, + 'groovy' => :groovy, + 'gvy' => :groovy, + 'h' => :c, + 'haml' => :haml, + 'htm' => :html, + 'html' => :html, + 'html.erb' => :erb, + 'java' => :java, + 'js' => :java_script, + 'json' => :json, + 'lua' => :lua, + 'mab' => :ruby, + 'pas' => :delphi, + 'patch' => :diff, + 'phtml' => :php, + 'php' => :php, + 'php3' => :php, + 'php4' => :php, + 'php5' => :php, + 'prawn' => :ruby, + 'py' => :python, + 'py3' => :python, + 'pyw' => :python, + 'rake' => :ruby, + 'raydebug' => :raydebug, + 'rb' => :ruby, + 'rbw' => :ruby, + 'rhtml' => :erb, + 'rjs' => :ruby, + 'rpdf' => :ruby, + 'ru' => :ruby, # config.ru + 'rxml' => :ruby, + 'sass' => :sass, + 'sql' => :sql, + 'taskpaper' => :taskpaper, + 'template' => :json, # AWS CloudFormation template + 'tmproj' => :xml, + 'xaml' => :xml, + 'xhtml' => :html, + 'xml' => :xml, + 'yaml' => :yaml, + 'yml' => :yaml, + } + for cpp_alias in %w[cc cpp cp cxx c++ C hh hpp h++ cu] + TypeFromExt[cpp_alias] = :cpp + end + + TypeFromShebang = /\b(?:ruby|perl|python|sh)\b/ + + TypeFromName = { + 'Capfile' => :ruby, + 'Rakefile' => :ruby, + 'Rantfile' => :ruby, + 'Gemfile' => :ruby, + 'Guardfile' => :ruby, + 'Vagrantfile' => :ruby, + 'Appraisals' => :ruby + } + + end + +end diff --git a/.bundle/gems/coderay-1.1.0/lib/coderay/helpers/plugin.rb b/.bundle/gems/coderay-1.1.0/lib/coderay/helpers/plugin.rb new file mode 100644 index 0000000..9a724ff --- /dev/null +++ b/.bundle/gems/coderay-1.1.0/lib/coderay/helpers/plugin.rb @@ -0,0 +1,274 @@ +module CodeRay + + # = PluginHost + # + # A simple subclass/subfolder plugin system. + # + # Example: + # class Generators + # extend PluginHost + # plugin_path 'app/generators' + # end + # + # class Generator + # extend Plugin + # PLUGIN_HOST = Generators + # end + # + # class FancyGenerator < Generator + # register_for :fancy + # end + # + # Generators[:fancy] #-> FancyGenerator + # # or + # CodeRay.require_plugin 'Generators/fancy' + # # or + # Generators::Fancy + module PluginHost + + # Raised if Encoders::[] fails because: + # * a file could not be found + # * the requested Plugin is not registered + PluginNotFound = Class.new LoadError + HostNotFound = Class.new LoadError + + PLUGIN_HOSTS = [] + PLUGIN_HOSTS_BY_ID = {} # dummy hash + + # Loads all plugins using list and load. + def load_all + for plugin in list + load plugin + end + end + + # Returns the Plugin for +id+. + # + # Example: + # yaml_plugin = MyPluginHost[:yaml] + def [] id, *args, &blk + plugin = validate_id(id) + begin + plugin = plugin_hash.[](plugin, *args, &blk) + end while plugin.is_a? String + plugin + end + + alias load [] + + # Tries to +load+ the missing plugin by translating +const+ to the + # underscore form (eg. LinesOfCode becomes lines_of_code). + def const_missing const + id = const.to_s. + gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2'). + gsub(/([a-z\d])([A-Z])/,'\1_\2'). + downcase + load id + end + + class << self + + # Adds the module/class to the PLUGIN_HOSTS list. + def extended mod + PLUGIN_HOSTS << mod + end + + end + + # The path where the plugins can be found. + def plugin_path *args + unless args.empty? + @plugin_path = File.expand_path File.join(*args) + end + @plugin_path ||= '' + end + + # Map a plugin_id to another. + # + # Usage: Put this in a file plugin_path/_map.rb. + # + # class MyColorHost < PluginHost + # map :navy => :dark_blue, + # :maroon => :brown, + # :luna => :moon + # end + def map hash + for from, to in hash + from = validate_id from + to = validate_id to + plugin_hash[from] = to unless plugin_hash.has_key? from + end + end + + # Define the default plugin to use when no plugin is found + # for a given id, or return the default plugin. + # + # See also map. + # + # class MyColorHost < PluginHost + # map :navy => :dark_blue + # default :gray + # end + # + # MyColorHost.default # loads and returns the Gray plugin + def default id = nil + if id + id = validate_id id + raise "The default plugin can't be named \"default\"." if id == :default + plugin_hash[:default] = id + else + load :default + end + end + + # Every plugin must register itself for +id+ by calling register_for, + # which calls this method. + # + # See Plugin#register_for. + def register plugin, id + plugin_hash[validate_id(id)] = plugin + end + + # A Hash of plugion_id => Plugin pairs. + def plugin_hash + @plugin_hash ||= (@plugin_hash = make_plugin_hash).tap { load_plugin_map } + end + + # Returns an array of all .rb files in the plugin path. + # + # The extension .rb is not included. + def list + Dir[path_to('*')].select do |file| + File.basename(file)[/^(?!_)\w+\.rb$/] + end.map do |file| + File.basename(file, '.rb').to_sym + end + end + + # Returns an array of all Plugins. + # + # Note: This loads all plugins using load_all. + def all_plugins + load_all + plugin_hash.values.grep(Class) + end + + # Loads the map file (see map). + # + # This is done automatically when plugin_path is called. + def load_plugin_map + mapfile = path_to '_map' + if File.exist? mapfile + require mapfile + true + else + false + end + end + + protected + + # Return a plugin hash that automatically loads plugins. + def make_plugin_hash + Hash.new do |h, plugin_id| + id = validate_id(plugin_id) + path = path_to id + begin + require path + rescue LoadError => boom + if h.has_key?(:default) + h[:default] + else + raise PluginNotFound, '%p could not load plugin %p: %s' % [self, id, boom] + end + else + # Plugin should have registered by now + if h.has_key? id + h[id] + else + raise PluginNotFound, "No #{self.name} plugin for #{id.inspect} found in #{path}." + end + end + end + end + + # Returns the expected path to the plugin file for the given id. + def path_to plugin_id + File.join plugin_path, "#{plugin_id}.rb" + end + + # Converts +id+ to a valid plugin ID String, or returns +nil+. + # + # Raises +ArgumentError+ for all other objects, or if the + # given String includes non-alphanumeric characters (\W). + def validate_id id + case id + when Symbol + id.to_s + when String + if id[/\w+/] == id + id.downcase + else + raise ArgumentError, "Invalid id given: #{id}" + end + else + raise ArgumentError, "Symbol or String expected, but #{id.class} given." + end + end + + end + + + # = Plugin + # + # Plugins have to include this module. + # + # IMPORTANT: Use extend for this module. + # + # See CodeRay::PluginHost for examples. + module Plugin + + attr_reader :plugin_id + + # Register this class for the given +id+. + # + # Example: + # class MyPlugin < PluginHost::BaseClass + # register_for :my_id + # ... + # end + # + # See PluginHost.register. + def register_for id + @plugin_id = id + plugin_host.register self, id + end + + # Returns the title of the plugin, or sets it to the + # optional argument +title+. + def title title = nil + if title + @title = title.to_s + else + @title ||= name[/([^:]+)$/, 1] + end + end + + # The PluginHost for this Plugin class. + def plugin_host host = nil + if host.is_a? PluginHost + const_set :PLUGIN_HOST, host + end + self::PLUGIN_HOST + end + + def aliases + plugin_host.plugin_hash.inject [] do |aliases, (key, _)| + aliases << key if plugin_host[key] == self + aliases + end + end + + end + +end diff --git a/.bundle/gems/coderay-1.1.0/lib/coderay/helpers/word_list.rb b/.bundle/gems/coderay-1.1.0/lib/coderay/helpers/word_list.rb new file mode 100644 index 0000000..4a42c4a --- /dev/null +++ b/.bundle/gems/coderay-1.1.0/lib/coderay/helpers/word_list.rb @@ -0,0 +1,72 @@ +module CodeRay + + # = WordList + # + # A Hash subclass designed for mapping word lists to token types. + # + # A WordList is a Hash with some additional features. + # It is intended to be used for keyword recognition. + # + # WordList is optimized to be used in Scanners, + # typically to decide whether a given ident is a special token. + # + # For case insensitive words use WordList::CaseIgnoring. + # + # Example: + # + # # define word arrays + # RESERVED_WORDS = %w[ + # asm break case continue default do else + # ] + # + # PREDEFINED_TYPES = %w[ + # int long short char void + # ] + # + # # make a WordList + # IDENT_KIND = WordList.new(:ident). + # add(RESERVED_WORDS, :reserved). + # add(PREDEFINED_TYPES, :predefined_type) + # + # ... + # + # def scan_tokens tokens, options + # ... + # + # elsif scan(/[A-Za-z_][A-Za-z_0-9]*/) + # # use it + # kind = IDENT_KIND[match] + # ... + class WordList < Hash + + # Create a new WordList with +default+ as default value. + def initialize default = false + super default + end + + # Add words to the list and associate them with +value+. + # + # Returns +self+, so you can concat add calls. + def add words, value = true + words.each { |word| self[word] = value } + self + end + + end + + + # A CaseIgnoring WordList is like a WordList, only that + # keys are compared case-insensitively (normalizing keys using +downcase+). + class WordList::CaseIgnoring < WordList + + def [] key + super key.downcase + end + + def []= key, value + super key.downcase, value + end + + end + +end diff --git a/.bundle/gems/coderay-1.1.0/lib/coderay/scanner.rb b/.bundle/gems/coderay-1.1.0/lib/coderay/scanner.rb new file mode 100644 index 0000000..b3f7e17 --- /dev/null +++ b/.bundle/gems/coderay-1.1.0/lib/coderay/scanner.rb @@ -0,0 +1,355 @@ +# encoding: utf-8 +require 'strscan' + +module CodeRay + + autoload :WordList, coderay_path('helpers', 'word_list') + + # = Scanners + # + # This module holds the Scanner class and its subclasses. + # For example, the Ruby scanner is named CodeRay::Scanners::Ruby + # can be found in coderay/scanners/ruby. + # + # Scanner also provides methods and constants for the register + # mechanism and the [] method that returns the Scanner class + # belonging to the given lang. + # + # See PluginHost. + module Scanners + extend PluginHost + plugin_path File.dirname(__FILE__), 'scanners' + + + # = Scanner + # + # The base class for all Scanners. + # + # It is a subclass of Ruby's great +StringScanner+, which + # makes it easy to access the scanning methods inside. + # + # It is also +Enumerable+, so you can use it like an Array of + # Tokens: + # + # require 'coderay' + # + # c_scanner = CodeRay::Scanners[:c].new "if (*p == '{') nest++;" + # + # for text, kind in c_scanner + # puts text if kind == :operator + # end + # + # # prints: (*==)++; + # + # OK, this is a very simple example :) + # You can also use +map+, +any?+, +find+ and even +sort_by+, + # if you want. + class Scanner < StringScanner + + extend Plugin + plugin_host Scanners + + # Raised if a Scanner fails while scanning + ScanError = Class.new StandardError + + # The default options for all scanner classes. + # + # Define @default_options for subclasses. + DEFAULT_OPTIONS = { } + + KINDS_NOT_LOC = [:comment, :doctype, :docstring] + + attr_accessor :state + + class << self + + # Normalizes the given code into a string with UNIX newlines, in the + # scanner's internal encoding, with invalid and undefined charachters + # replaced by placeholders. Always returns a new object. + def normalize code + # original = code + code = code.to_s unless code.is_a? ::String + return code if code.empty? + + if code.respond_to? :encoding + code = encode_with_encoding code, self.encoding + else + code = to_unix code + end + # code = code.dup if code.eql? original + code + end + + # The typical filename suffix for this scanner's language. + def file_extension extension = lang + @file_extension ||= extension.to_s + end + + # The encoding used internally by this scanner. + def encoding name = 'UTF-8' + @encoding ||= defined?(Encoding.find) && Encoding.find(name) + end + + # The lang of this Scanner class, which is equal to its Plugin ID. + def lang + @plugin_id + end + + protected + + def encode_with_encoding code, target_encoding + if code.encoding == target_encoding + if code.valid_encoding? + return to_unix(code) + else + source_encoding = guess_encoding code + end + else + source_encoding = code.encoding + end + # print "encode_with_encoding from #{source_encoding} to #{target_encoding}" + code.encode target_encoding, source_encoding, :universal_newline => true, :undef => :replace, :invalid => :replace + end + + def to_unix code + code.index(?\r) ? code.gsub(/\r\n?/, "\n") : code + end + + def guess_encoding s + #:nocov: + IO.popen("file -b --mime -", "w+") do |file| + file.write s[0, 1024] + file.close_write + begin + Encoding.find file.gets[/charset=([-\w]+)/, 1] + rescue ArgumentError + Encoding::BINARY + end + end + #:nocov: + end + + end + + # Create a new Scanner. + # + # * +code+ is the input String and is handled by the superclass + # StringScanner. + # * +options+ is a Hash with Symbols as keys. + # It is merged with the default options of the class (you can + # overwrite default options here.) + # + # Else, a Tokens object is used. + def initialize code = '', options = {} + if self.class == Scanner + raise NotImplementedError, "I am only the basic Scanner class. I can't scan anything. :( Use my subclasses." + end + + @options = self.class::DEFAULT_OPTIONS.merge options + + super self.class.normalize(code) + + @tokens = options[:tokens] || Tokens.new + @tokens.scanner = self if @tokens.respond_to? :scanner= + + setup + end + + # Sets back the scanner. Subclasses should redefine the reset_instance + # method instead of this one. + def reset + super + reset_instance + end + + # Set a new string to be scanned. + def string= code + code = self.class.normalize(code) + super code + reset_instance + end + + # the Plugin ID for this scanner + def lang + self.class.lang + end + + # the default file extension for this scanner + def file_extension + self.class.file_extension + end + + # Scan the code and returns all tokens in a Tokens object. + def tokenize source = nil, options = {} + options = @options.merge(options) + + set_tokens_from_options options + set_string_from_source source + + begin + scan_tokens @tokens, options + rescue => e + message = "Error in %s#scan_tokens, initial state was: %p" % [self.class, defined?(state) && state] + raise_inspect e.message, @tokens, message, 30, e.backtrace + end + + @cached_tokens = @tokens + if source.is_a? Array + @tokens.split_into_parts(*source.map { |part| part.size }) + else + @tokens + end + end + + # Cache the result of tokenize. + def tokens + @cached_tokens ||= tokenize + end + + # Traverse the tokens. + def each &block + tokens.each(&block) + end + include Enumerable + + # The current line position of the scanner, starting with 1. + # See also: #column. + # + # Beware, this is implemented inefficiently. It should be used + # for debugging only. + def line pos = self.pos + return 1 if pos <= 0 + binary_string[0...pos].count("\n") + 1 + end + + # The current column position of the scanner, starting with 1. + # See also: #line. + def column pos = self.pos + return 1 if pos <= 0 + pos - (binary_string.rindex(?\n, pos - 1) || -1) + end + + # The string in binary encoding. + # + # To be used with #pos, which is the index of the byte the scanner + # will scan next. + def binary_string + @binary_string ||= + if string.respond_to?(:bytesize) && string.bytesize != string.size + #:nocov: + string.dup.force_encoding('binary') + #:nocov: + else + string + end + end + + protected + + # Can be implemented by subclasses to do some initialization + # that has to be done once per instance. + # + # Use reset for initialization that has to be done once per + # scan. + def setup # :doc: + end + + def set_string_from_source source + case source + when Array + self.string = self.class.normalize(source.join) + when nil + reset + else + self.string = self.class.normalize(source) + end + end + + def set_tokens_from_options options + @tokens = options[:tokens] || @tokens || Tokens.new + @tokens.scanner = self if @tokens.respond_to? :scanner= + end + + # This is the central method, and commonly the only one a + # subclass implements. + # + # Subclasses must implement this method; it must return +tokens+ + # and must only use Tokens#<< for storing scanned tokens! + def scan_tokens tokens, options # :doc: + raise NotImplementedError, "#{self.class}#scan_tokens not implemented." + end + + # Resets the scanner. + def reset_instance + @tokens.clear if @tokens.respond_to?(:clear) && !@options[:keep_tokens] + @cached_tokens = nil + @binary_string = nil if defined? @binary_string + end + + SCAN_ERROR_MESSAGE = <<-MESSAGE + + +***ERROR in %s: %s (after %s tokens) + +tokens: +%s + +%s + +surrounding code: +%p ~~ %p + + +***ERROR*** + + MESSAGE + + def raise_inspect_arguments message, tokens, state, ambit + return File.basename(caller[0]), + message, + tokens_size(tokens), + tokens_last(tokens, 10).map(&:inspect).join("\n"), + scanner_state_info(state), + binary_string[pos - ambit, ambit], + binary_string[pos, ambit] + end + + SCANNER_STATE_INFO = <<-INFO +current line: %d column: %d pos: %d +matched: %p state: %p +bol?: %p, eos?: %p + INFO + + def scanner_state_info state + SCANNER_STATE_INFO % [ + line, column, pos, + matched, state || 'No state given!', + bol?, eos?, + ] + end + + # Scanner error with additional status information + def raise_inspect message, tokens, state = self.state, ambit = 30, backtrace = caller + raise ScanError, SCAN_ERROR_MESSAGE % raise_inspect_arguments(message, tokens, state, ambit), backtrace + end + + def tokens_size tokens + tokens.size if tokens.respond_to?(:size) + end + + def tokens_last tokens, n + tokens.respond_to?(:last) ? tokens.last(n) : [] + end + + # Shorthand for scan_until(/\z/). + # This method also avoids a JRuby 1.9 mode bug. + def scan_rest + rest = self.rest + terminate + rest + end + + end + + end +end diff --git a/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/_map.rb b/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/_map.rb new file mode 100644 index 0000000..a240298 --- /dev/null +++ b/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/_map.rb @@ -0,0 +1,24 @@ +module CodeRay +module Scanners + + map \ + :'c++' => :cpp, + :cplusplus => :cpp, + :ecmascript => :java_script, + :ecma_script => :java_script, + :rhtml => :erb, + :eruby => :erb, + :irb => :ruby, + :javascript => :java_script, + :js => :java_script, + :pascal => :delphi, + :patch => :diff, + :plain => :text, + :plaintext => :text, + :xhtml => :html, + :yml => :yaml + + default :text + +end +end diff --git a/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/c.rb b/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/c.rb new file mode 100644 index 0000000..84b6e8e --- /dev/null +++ b/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/c.rb @@ -0,0 +1,189 @@ +module CodeRay +module Scanners + + # Scanner for C. + class C < Scanner + + register_for :c + file_extension 'c' + + KEYWORDS = [ + 'asm', 'break', 'case', 'continue', 'default', 'do', + 'else', 'enum', 'for', 'goto', 'if', 'return', + 'sizeof', 'struct', 'switch', 'typedef', 'union', 'while', + 'restrict', # added in C99 + ] # :nodoc: + + PREDEFINED_TYPES = [ + 'int', 'long', 'short', 'char', + 'signed', 'unsigned', 'float', 'double', + 'bool', 'complex', # added in C99 + ] # :nodoc: + + PREDEFINED_CONSTANTS = [ + 'EOF', 'NULL', + 'true', 'false', # added in C99 + ] # :nodoc: + DIRECTIVES = [ + 'auto', 'extern', 'register', 'static', 'void', + 'const', 'volatile', # added in C89 + 'inline', # added in C99 + ] # :nodoc: + + IDENT_KIND = WordList.new(:ident). + add(KEYWORDS, :keyword). + add(PREDEFINED_TYPES, :predefined_type). + add(DIRECTIVES, :directive). + add(PREDEFINED_CONSTANTS, :predefined_constant) # :nodoc: + + ESCAPE = / [rbfntv\n\\'"] | x[a-fA-F0-9]{1,2} | [0-7]{1,3} /x # :nodoc: + UNICODE_ESCAPE = / u[a-fA-F0-9]{4} | U[a-fA-F0-9]{8} /x # :nodoc: + + protected + + def scan_tokens encoder, options + + state = :initial + label_expected = true + case_expected = false + label_expected_before_preproc_line = nil + in_preproc_line = false + + until eos? + + case state + + when :initial + + if match = scan(/ \s+ | \\\n /x) + if in_preproc_line && match != "\\\n" && match.index(?\n) + in_preproc_line = false + label_expected = label_expected_before_preproc_line + end + encoder.text_token match, :space + + elsif match = scan(%r! // [^\n\\]* (?: \\. [^\n\\]* )* | /\* (?: .*? \*/ | .* ) !mx) + encoder.text_token match, :comment + + elsif match = scan(/ [-+*=<>?:;,!&^|()\[\]{}~%]+ | \/=? | \.(?!\d) /x) + label_expected = match =~ /[;\{\}]/ + if case_expected + label_expected = true if match == ':' + case_expected = false + end + encoder.text_token match, :operator + + elsif match = scan(/ [A-Za-z_][A-Za-z_0-9]* /x) + kind = IDENT_KIND[match] + if kind == :ident && label_expected && !in_preproc_line && scan(/:(?!:)/) + kind = :label + match << matched + else + label_expected = false + if kind == :keyword + case match + when 'case', 'default' + case_expected = true + end + end + end + encoder.text_token match, kind + + elsif match = scan(/L?"/) + encoder.begin_group :string + if match[0] == ?L + encoder.text_token 'L', :modifier + match = '"' + end + encoder.text_token match, :delimiter + state = :string + + elsif match = scan(/ \# \s* if \s* 0 /x) + match << scan_until(/ ^\# (?:elif|else|endif) .*? $ | \z /xm) unless eos? + encoder.text_token match, :comment + + elsif match = scan(/#[ \t]*(\w*)/) + encoder.text_token match, :preprocessor + in_preproc_line = true + label_expected_before_preproc_line = label_expected + state = :include_expected if self[1] == 'include' + + elsif match = scan(/ L?' (?: [^\'\n\\] | \\ #{ESCAPE} )? '? /ox) + label_expected = false + encoder.text_token match, :char + + elsif match = scan(/\$/) + encoder.text_token match, :ident + + elsif match = scan(/0[xX][0-9A-Fa-f]+/) + label_expected = false + encoder.text_token match, :hex + + elsif match = scan(/(?:0[0-7]+)(?![89.eEfF])/) + label_expected = false + encoder.text_token match, :octal + + elsif match = scan(/(?:\d+)(?![.eEfF])L?L?/) + label_expected = false + encoder.text_token match, :integer + + elsif match = scan(/\d[fF]?|\d*\.\d+(?:[eE][+-]?\d+)?[fF]?|\d+[eE][+-]?\d+[fF]?/) + label_expected = false + encoder.text_token match, :float + + else + encoder.text_token getch, :error + + end + + when :string + if match = scan(/[^\\\n"]+/) + encoder.text_token match, :content + elsif match = scan(/"/) + encoder.text_token match, :delimiter + encoder.end_group :string + state = :initial + label_expected = false + elsif match = scan(/ \\ (?: #{ESCAPE} | #{UNICODE_ESCAPE} ) /mox) + encoder.text_token match, :char + elsif match = scan(/ \\ | $ /x) + encoder.end_group :string + encoder.text_token match, :error unless match.empty? + state = :initial + label_expected = false + else + raise_inspect "else case \" reached; %p not handled." % peek(1), encoder + end + + when :include_expected + if match = scan(/<[^>\n]+>?|"[^"\n\\]*(?:\\.[^"\n\\]*)*"?/) + encoder.text_token match, :include + state = :initial + + elsif match = scan(/\s+/) + encoder.text_token match, :space + state = :initial if match.index ?\n + + else + state = :initial + + end + + else + raise_inspect 'Unknown state', encoder + + end + + end + + if state == :string + encoder.end_group :string + end + + encoder + end + + end + +end +end diff --git a/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/clojure.rb b/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/clojure.rb new file mode 100644 index 0000000..f8fbf65 --- /dev/null +++ b/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/clojure.rb @@ -0,0 +1,217 @@ +# encoding: utf-8 +module CodeRay + module Scanners + + # Clojure scanner by Licenser. + class Clojure < Scanner + + register_for :clojure + file_extension 'clj' + + SPECIAL_FORMS = %w[ + def if do let quote var fn loop recur throw try catch monitor-enter monitor-exit . + new + ] # :nodoc: + + CORE_FORMS = %w[ + + - -> ->> .. / * <= < = == >= > accessor aclone add-classpath add-watch + agent agent-error agent-errors aget alength alias all-ns alter alter-meta! + alter-var-root amap ancestors and apply areduce array-map aset aset-boolean + aset-byte aset-char aset-double aset-float aset-int aset-long aset-short + assert assoc assoc! assoc-in associative? atom await await-for bases bean + bigdec bigint binding bit-and bit-and-not bit-clear bit-flip bit-not bit-or + bit-set bit-shift-left bit-shift-right bit-test bit-xor boolean boolean-array + booleans bound-fn bound-fn* bound? butlast byte byte-array bytes case cast char + char-array char-escape-string char-name-string char? chars class class? + clear-agent-errors clojure-version coll? comment commute comp comparator + compare compare-and-set! compile complement concat cond condp conj conj! + cons constantly construct-proxy contains? count counted? create-ns + create-struct cycle dec decimal? declare definline defmacro defmethod defmulti + defn defn- defonce defprotocol defrecord defstruct deftype delay delay? + deliver denominator deref derive descendants disj disj! dissoc dissoc! + distinct distinct? doall doc dorun doseq dosync dotimes doto double + double-array doubles drop drop-last drop-while empty empty? ensure + enumeration-seq error-handler error-mode eval even? every? extend + extend-protocol extend-type extenders extends? false? ffirst file-seq + filter find find-doc find-ns find-var first float float-array float? + floats flush fn fn? fnext for force format future future-call future-cancel + future-cancelled? future-done? future? gen-class gen-interface gensym get + get-in get-method get-proxy-class get-thread-bindings get-validator hash + hash-map hash-set identical? identity if-let if-not ifn? import in-ns + inc init-proxy instance? int int-array integer? interleave intern + interpose into into-array ints io! isa? iterate iterator-seq juxt key + keys keyword keyword? last lazy-cat lazy-seq let letfn line-seq list list* + list? load load-file load-reader load-string loaded-libs locking long + long-array longs loop macroexpand macroexpand-1 make-array make-hierarchy + map map? mapcat max max-key memfn memoize merge merge-with meta methods + min min-key mod name namespace neg? newline next nfirst nil? nnext not + not-any? not-empty not-every? not= ns ns-aliases ns-imports ns-interns + ns-map ns-name ns-publics ns-refers ns-resolve ns-unalias ns-unmap nth + nthnext num number? numerator object-array odd? or parents partial + partition pcalls peek persistent! pmap pop pop! pop-thread-bindings + pos? pr pr-str prefer-method prefers print print-namespace-doc + print-str printf println println-str prn prn-str promise proxy + proxy-mappings proxy-super push-thread-bindings pvalues quot rand + rand-int range ratio? rationalize re-find re-groups re-matcher + re-matches re-pattern re-seq read read-line read-string reduce ref + ref-history-count ref-max-history ref-min-history ref-set refer + refer-clojure reify release-pending-sends rem remove remove-all-methods + remove-method remove-ns remove-watch repeat repeatedly replace replicate + require reset! reset-meta! resolve rest restart-agent resultset-seq + reverse reversible? rseq rsubseq satisfies? second select-keys send + send-off seq seq? seque sequence sequential? set set-error-handler! + set-error-mode! set-validator! set? short short-array shorts + shutdown-agents slurp some sort sort-by sorted-map sorted-map-by + sorted-set sorted-set-by sorted? special-form-anchor special-symbol? + split-at split-with str string? struct struct-map subs subseq subvec + supers swap! symbol symbol? sync syntax-symbol-anchor take take-last + take-nth take-while test the-ns thread-bound? time to-array to-array-2d + trampoline transient tree-seq true? type unchecked-add unchecked-dec + unchecked-divide unchecked-inc unchecked-multiply unchecked-negate + unchecked-remainder unchecked-subtract underive update-in update-proxy + use val vals var-get var-set var? vary-meta vec vector vector-of vector? + when when-first when-let when-not while with-bindings with-bindings* + with-in-str with-local-vars with-meta with-open with-out-str + with-precision xml-seq zero? zipmap + ] # :nodoc: + + PREDEFINED_CONSTANTS = %w[ + true false nil *1 *2 *3 *agent* *clojure-version* *command-line-args* + *compile-files* *compile-path* *e *err* *file* *flush-on-newline* + *in* *ns* *out* *print-dup* *print-length* *print-level* *print-meta* + *print-readably* *read-eval* *warn-on-reflection* + ] # :nodoc: + + IDENT_KIND = WordList.new(:ident). + add(SPECIAL_FORMS, :keyword). + add(CORE_FORMS, :keyword). + add(PREDEFINED_CONSTANTS, :predefined_constant) + + KEYWORD_NEXT_TOKEN_KIND = WordList.new(nil). + add(%w[ def defn defn- definline defmacro defmulti defmethod defstruct defonce declare ], :function). + add(%w[ ns ], :namespace). + add(%w[ defprotocol defrecord ], :class) + + BASIC_IDENTIFIER = /[a-zA-Z$%*\/_+!?&<>\-=]=?[a-zA-Z0-9$&*+!\/_?<>\-\#]*/ + IDENTIFIER = /(?!-\d)(?:(?:#{BASIC_IDENTIFIER}\.)*#{BASIC_IDENTIFIER}(?:\/#{BASIC_IDENTIFIER})?\.?)|\.\.?/ + SYMBOL = /::?#{IDENTIFIER}/o + DIGIT = /\d/ + DIGIT10 = DIGIT + DIGIT16 = /[0-9a-f]/i + DIGIT8 = /[0-7]/ + DIGIT2 = /[01]/ + RADIX16 = /\#x/i + RADIX8 = /\#o/i + RADIX2 = /\#b/i + RADIX10 = /\#d/i + EXACTNESS = /#i|#e/i + SIGN = /[\+-]?/ + EXP_MARK = /[esfdl]/i + EXP = /#{EXP_MARK}#{SIGN}#{DIGIT}+/ + SUFFIX = /#{EXP}?/ + PREFIX10 = /#{RADIX10}?#{EXACTNESS}?|#{EXACTNESS}?#{RADIX10}?/ + PREFIX16 = /#{RADIX16}#{EXACTNESS}?|#{EXACTNESS}?#{RADIX16}/ + PREFIX8 = /#{RADIX8}#{EXACTNESS}?|#{EXACTNESS}?#{RADIX8}/ + PREFIX2 = /#{RADIX2}#{EXACTNESS}?|#{EXACTNESS}?#{RADIX2}/ + UINT10 = /#{DIGIT10}+#*/ + UINT16 = /#{DIGIT16}+#*/ + UINT8 = /#{DIGIT8}+#*/ + UINT2 = /#{DIGIT2}+#*/ + DECIMAL = /#{DIGIT10}+#+\.#*#{SUFFIX}|#{DIGIT10}+\.#{DIGIT10}*#*#{SUFFIX}|\.#{DIGIT10}+#*#{SUFFIX}|#{UINT10}#{EXP}/ + UREAL10 = /#{UINT10}\/#{UINT10}|#{DECIMAL}|#{UINT10}/ + UREAL16 = /#{UINT16}\/#{UINT16}|#{UINT16}/ + UREAL8 = /#{UINT8}\/#{UINT8}|#{UINT8}/ + UREAL2 = /#{UINT2}\/#{UINT2}|#{UINT2}/ + REAL10 = /#{SIGN}#{UREAL10}/ + REAL16 = /#{SIGN}#{UREAL16}/ + REAL8 = /#{SIGN}#{UREAL8}/ + REAL2 = /#{SIGN}#{UREAL2}/ + IMAG10 = /i|#{UREAL10}i/ + IMAG16 = /i|#{UREAL16}i/ + IMAG8 = /i|#{UREAL8}i/ + IMAG2 = /i|#{UREAL2}i/ + COMPLEX10 = /#{REAL10}@#{REAL10}|#{REAL10}\+#{IMAG10}|#{REAL10}-#{IMAG10}|\+#{IMAG10}|-#{IMAG10}|#{REAL10}/ + COMPLEX16 = /#{REAL16}@#{REAL16}|#{REAL16}\+#{IMAG16}|#{REAL16}-#{IMAG16}|\+#{IMAG16}|-#{IMAG16}|#{REAL16}/ + COMPLEX8 = /#{REAL8}@#{REAL8}|#{REAL8}\+#{IMAG8}|#{REAL8}-#{IMAG8}|\+#{IMAG8}|-#{IMAG8}|#{REAL8}/ + COMPLEX2 = /#{REAL2}@#{REAL2}|#{REAL2}\+#{IMAG2}|#{REAL2}-#{IMAG2}|\+#{IMAG2}|-#{IMAG2}|#{REAL2}/ + NUM10 = /#{PREFIX10}?#{COMPLEX10}/ + NUM16 = /#{PREFIX16}#{COMPLEX16}/ + NUM8 = /#{PREFIX8}#{COMPLEX8}/ + NUM2 = /#{PREFIX2}#{COMPLEX2}/ + NUM = /#{NUM10}|#{NUM16}|#{NUM8}|#{NUM2}/ + + protected + + def scan_tokens encoder, options + + state = :initial + kind = nil + + until eos? + + case state + when :initial + if match = scan(/ \s+ | \\\n | , /x) + encoder.text_token match, :space + elsif match = scan(/['`\(\[\)\]\{\}]|\#[({]|~@?|[@\^]/) + encoder.text_token match, :operator + elsif match = scan(/;.*/) + encoder.text_token match, :comment # TODO: recognize (comment ...) too + elsif match = scan(/\#?\\(?:newline|space|.?)/) + encoder.text_token match, :char + elsif match = scan(/\#[ft]/) + encoder.text_token match, :predefined_constant + elsif match = scan(/#{IDENTIFIER}/o) + kind = IDENT_KIND[match] + encoder.text_token match, kind + if rest? && kind == :keyword + if kind = KEYWORD_NEXT_TOKEN_KIND[match] + encoder.text_token match, :space if match = scan(/\s+/o) + encoder.text_token match, kind if match = scan(/#{IDENTIFIER}/o) + end + end + elsif match = scan(/#{SYMBOL}/o) + encoder.text_token match, :symbol + elsif match = scan(/\./) + encoder.text_token match, :operator + elsif match = scan(/ \# \^ #{IDENTIFIER} /ox) + encoder.text_token match, :type + elsif match = scan(/ (\#)? " /x) + state = self[1] ? :regexp : :string + encoder.begin_group state + encoder.text_token match, :delimiter + elsif match = scan(/#{NUM}/o) and not matched.empty? + encoder.text_token match, match[/[.e\/]/i] ? :float : :integer + else + encoder.text_token getch, :error + end + + when :string, :regexp + if match = scan(/[^"\\]+|\\.?/) + encoder.text_token match, :content + elsif match = scan(/"/) + encoder.text_token match, :delimiter + encoder.end_group state + state = :initial + else + raise_inspect "else case \" reached; %p not handled." % peek(1), + encoder, state + end + + else + raise 'else case reached' + + end + + end + + if [:string, :regexp].include? state + encoder.end_group state + end + + encoder + + end + end + end +end \ No newline at end of file diff --git a/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/cpp.rb b/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/cpp.rb new file mode 100644 index 0000000..e61f56f --- /dev/null +++ b/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/cpp.rb @@ -0,0 +1,215 @@ +module CodeRay +module Scanners + + # Scanner for C++. + # + # Aliases: +cplusplus+, c++ + class CPlusPlus < Scanner + + register_for :cpp + file_extension 'cpp' + title 'C++' + + #-- http://www.cppreference.com/wiki/keywords/start + KEYWORDS = [ + 'and', 'and_eq', 'asm', 'bitand', 'bitor', 'break', + 'case', 'catch', 'class', 'compl', 'const_cast', + 'continue', 'default', 'delete', 'do', 'dynamic_cast', 'else', + 'enum', 'export', 'for', 'goto', 'if', 'namespace', 'new', + 'not', 'not_eq', 'or', 'or_eq', 'reinterpret_cast', 'return', + 'sizeof', 'static_cast', 'struct', 'switch', 'template', + 'throw', 'try', 'typedef', 'typeid', 'typename', 'union', + 'while', 'xor', 'xor_eq', + ] # :nodoc: + + PREDEFINED_TYPES = [ + 'bool', 'char', 'double', 'float', 'int', 'long', + 'short', 'signed', 'unsigned', 'wchar_t', 'string', + ] # :nodoc: + PREDEFINED_CONSTANTS = [ + 'false', 'true', + 'EOF', 'NULL', + ] # :nodoc: + PREDEFINED_VARIABLES = [ + 'this', + ] # :nodoc: + DIRECTIVES = [ + 'auto', 'const', 'explicit', 'extern', 'friend', 'inline', 'mutable', 'operator', + 'private', 'protected', 'public', 'register', 'static', 'using', 'virtual', 'void', + 'volatile', + ] # :nodoc: + + IDENT_KIND = WordList.new(:ident). + add(KEYWORDS, :keyword). + add(PREDEFINED_TYPES, :predefined_type). + add(PREDEFINED_VARIABLES, :local_variable). + add(DIRECTIVES, :directive). + add(PREDEFINED_CONSTANTS, :predefined_constant) # :nodoc: + + ESCAPE = / [rbfntv\n\\'"] | x[a-fA-F0-9]{1,2} | [0-7]{1,3} /x # :nodoc: + UNICODE_ESCAPE = / u[a-fA-F0-9]{4} | U[a-fA-F0-9]{8} /x # :nodoc: + + protected + + def scan_tokens encoder, options + + state = :initial + label_expected = true + case_expected = false + label_expected_before_preproc_line = nil + in_preproc_line = false + + until eos? + + case state + + when :initial + + if match = scan(/ \s+ | \\\n /x) + if in_preproc_line && match != "\\\n" && match.index(?\n) + in_preproc_line = false + label_expected = label_expected_before_preproc_line + end + encoder.text_token match, :space + + elsif match = scan(%r! // [^\n\\]* (?: \\. [^\n\\]* )* | /\* (?: .*? \*/ | .* ) !mx) + encoder.text_token match, :comment + + elsif match = scan(/ \# \s* if \s* 0 /x) + match << scan_until(/ ^\# (?:elif|else|endif) .*? $ | \z /xm) unless eos? + encoder.text_token match, :comment + + elsif match = scan(/ [-+*=<>?:;,!&^|()\[\]{}~%]+ | \/=? | \.(?!\d) /x) + label_expected = match =~ /[;\{\}]/ + if case_expected + label_expected = true if match == ':' + case_expected = false + end + encoder.text_token match, :operator + + elsif match = scan(/ [A-Za-z_][A-Za-z_0-9]* /x) + kind = IDENT_KIND[match] + if kind == :ident && label_expected && !in_preproc_line && scan(/:(?!:)/) + kind = :label + match << matched + else + label_expected = false + if kind == :keyword + case match + when 'class' + state = :class_name_expected + when 'case', 'default' + case_expected = true + end + end + end + encoder.text_token match, kind + + elsif match = scan(/\$/) + encoder.text_token match, :ident + + elsif match = scan(/L?"/) + encoder.begin_group :string + if match[0] == ?L + encoder.text_token match, 'L', :modifier + match = '"' + end + state = :string + encoder.text_token match, :delimiter + + elsif match = scan(/#[ \t]*(\w*)/) + encoder.text_token match, :preprocessor + in_preproc_line = true + label_expected_before_preproc_line = label_expected + state = :include_expected if self[1] == 'include' + + elsif match = scan(/ L?' (?: [^\'\n\\] | \\ #{ESCAPE} )? '? /ox) + label_expected = false + encoder.text_token match, :char + + elsif match = scan(/0[xX][0-9A-Fa-f]+/) + label_expected = false + encoder.text_token match, :hex + + elsif match = scan(/(?:0[0-7]+)(?![89.eEfF])/) + label_expected = false + encoder.text_token match, :octal + + elsif match = scan(/(?:\d+)(?![.eEfF])L?L?/) + label_expected = false + encoder.text_token match, :integer + + elsif match = scan(/\d[fF]?|\d*\.\d+(?:[eE][+-]?\d+)?[fF]?|\d+[eE][+-]?\d+[fF]?/) + label_expected = false + encoder.text_token match, :float + + else + encoder.text_token getch, :error + + end + + when :string + if match = scan(/[^\\"]+/) + encoder.text_token match, :content + elsif match = scan(/"/) + encoder.text_token match, :delimiter + encoder.end_group :string + state = :initial + label_expected = false + elsif match = scan(/ \\ (?: #{ESCAPE} | #{UNICODE_ESCAPE} ) /mox) + encoder.text_token match, :char + elsif match = scan(/ \\ | $ /x) + encoder.end_group :string + encoder.text_token match, :error unless match.empty? + state = :initial + label_expected = false + else + raise_inspect "else case \" reached; %p not handled." % peek(1), encoder + end + + when :include_expected + if match = scan(/<[^>\n]+>?|"[^"\n\\]*(?:\\.[^"\n\\]*)*"?/) + encoder.text_token match, :include + state = :initial + + elsif match = scan(/\s+/) + encoder.text_token match, :space + state = :initial if match.index ?\n + + else + state = :initial + + end + + when :class_name_expected + if match = scan(/ [A-Za-z_][A-Za-z_0-9]* /x) + encoder.text_token match, :class + state = :initial + + elsif match = scan(/\s+/) + encoder.text_token match, :space + + else + encoder.text_token getch, :error + state = :initial + + end + + else + raise_inspect 'Unknown state', encoder + + end + + end + + if state == :string + encoder.end_group :string + end + + encoder + end + + end + +end +end diff --git a/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/css.rb b/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/css.rb new file mode 100644 index 0000000..55d5239 --- /dev/null +++ b/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/css.rb @@ -0,0 +1,196 @@ +module CodeRay +module Scanners + + class CSS < Scanner + + register_for :css + + KINDS_NOT_LOC = [ + :comment, + :class, :pseudo_class, :tag, + :id, :directive, + :key, :value, :operator, :color, :float, :string, + :error, :important, :type, + ] # :nodoc: + + module RE # :nodoc: + Hex = /[0-9a-fA-F]/ + Unicode = /\\#{Hex}{1,6}\b/ # differs from standard because it allows uppercase hex too + Escape = /#{Unicode}|\\[^\n0-9a-fA-F]/ + NMChar = /[-_a-zA-Z0-9]/ + NMStart = /[_a-zA-Z]/ + String1 = /"(?:[^\n\\"]+|\\\n|#{Escape})*"?/ # TODO: buggy regexp + String2 = /'(?:[^\n\\']+|\\\n|#{Escape})*'?/ # TODO: buggy regexp + String = /#{String1}|#{String2}/ + + HexColor = /#(?:#{Hex}{6}|#{Hex}{3})/ + + Num = /-?(?:[0-9]*\.[0-9]+|[0-9]+)n?/ + Name = /#{NMChar}+/ + Ident = /-?#{NMStart}#{NMChar}*/ + AtKeyword = /@#{Ident}/ + Percentage = /#{Num}%/ + + reldimensions = %w[em ex px] + absdimensions = %w[in cm mm pt pc] + Unit = Regexp.union(*(reldimensions + absdimensions + %w[s dpi dppx deg])) + + Dimension = /#{Num}#{Unit}/ + + Function = /(?:url|alpha|attr|counters?)\((?:[^)\n]|\\\))*\)?/ + + Id = /(?!#{HexColor}\b(?!-))##{Name}/ + Class = /\.#{Name}/ + PseudoClass = /::?#{Ident}/ + AttributeSelector = /\[[^\]]*\]?/ + end + + protected + + def setup + @state = :initial + @value_expected = false + end + + def scan_tokens encoder, options + states = Array(options[:state] || @state).dup + value_expected = @value_expected + + until eos? + + if match = scan(/\s+/) + encoder.text_token match, :space + + elsif case states.last + when :initial, :media + if match = scan(/(?>#{RE::Ident})(?!\()|\*/ox) + encoder.text_token match, :tag + next + elsif match = scan(RE::Class) + encoder.text_token match, :class + next + elsif match = scan(RE::Id) + encoder.text_token match, :id + next + elsif match = scan(RE::PseudoClass) + encoder.text_token match, :pseudo_class + next + elsif match = scan(RE::AttributeSelector) + # TODO: Improve highlighting inside of attribute selectors. + encoder.text_token match[0,1], :operator + encoder.text_token match[1..-2], :attribute_name if match.size > 2 + encoder.text_token match[-1,1], :operator if match[-1] == ?] + next + elsif match = scan(/@media/) + encoder.text_token match, :directive + states.push :media_before_name + next + end + + when :block + if match = scan(/(?>#{RE::Ident})(?!\()/ox) + if value_expected + encoder.text_token match, :value + else + encoder.text_token match, :key + end + next + end + + when :media_before_name + if match = scan(RE::Ident) + encoder.text_token match, :type + states[-1] = :media_after_name + next + end + + when :media_after_name + if match = scan(/\{/) + encoder.text_token match, :operator + states[-1] = :media + next + end + + else + #:nocov: + raise_inspect 'Unknown state', encoder + #:nocov: + + end + + elsif match = scan(/\/\*(?:.*?\*\/|\z)/m) + encoder.text_token match, :comment + + elsif match = scan(/\{/) + value_expected = false + encoder.text_token match, :operator + states.push :block + + elsif match = scan(/\}/) + value_expected = false + encoder.text_token match, :operator + if states.last == :block || states.last == :media + states.pop + end + + elsif match = scan(/#{RE::String}/o) + encoder.begin_group :string + encoder.text_token match[0, 1], :delimiter + encoder.text_token match[1..-2], :content if match.size > 2 + encoder.text_token match[-1, 1], :delimiter if match.size >= 2 + encoder.end_group :string + + elsif match = scan(/#{RE::Function}/o) + encoder.begin_group :function + start = match[/^\w+\(/] + encoder.text_token start, :delimiter + if match[-1] == ?) + encoder.text_token match[start.size..-2], :content if match.size > start.size + 1 + encoder.text_token ')', :delimiter + else + encoder.text_token match[start.size..-1], :content if match.size > start.size + end + encoder.end_group :function + + elsif match = scan(/(?: #{RE::Dimension} | #{RE::Percentage} | #{RE::Num} )/ox) + encoder.text_token match, :float + + elsif match = scan(/#{RE::HexColor}/o) + encoder.text_token match, :color + + elsif match = scan(/! *important/) + encoder.text_token match, :important + + elsif match = scan(/(?:rgb|hsl)a?\([^()\n]*\)?/) + encoder.text_token match, :color + + elsif match = scan(RE::AtKeyword) + encoder.text_token match, :directive + + elsif match = scan(/ [+>~:;,.=()\/] /x) + if match == ':' + value_expected = true + elsif match == ';' + value_expected = false + end + encoder.text_token match, :operator + + else + encoder.text_token getch, :error + + end + + end + + if options[:keep_state] + @state = states + @value_expected = value_expected + end + + encoder + end + + end + +end +end diff --git a/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/debug.rb b/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/debug.rb new file mode 100644 index 0000000..83ede9a --- /dev/null +++ b/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/debug.rb @@ -0,0 +1,75 @@ +require 'set' + +module CodeRay +module Scanners + + # = Debug Scanner + # + # Interprets the output of the Encoders::Debug encoder (basically the inverse function). + class Debug < Scanner + + register_for :debug + title 'CodeRay Token Dump Import' + + protected + + def setup + super + @known_token_kinds = TokenKinds.keys.map(&:to_s).to_set + end + + def scan_tokens encoder, options + + opened_tokens = [] + + until eos? + + if match = scan(/\s+/) + encoder.text_token match, :space + + elsif match = scan(/ (\w+) \( ( [^\)\\]* ( \\. [^\)\\]* )* ) \)? /x) + if @known_token_kinds.include? self[1] + encoder.text_token self[2].gsub(/\\(.)/m, '\1'), self[1].to_sym + else + encoder.text_token matched, :unknown + end + + elsif match = scan(/ (\w+) ([<\[]) /x) + if @known_token_kinds.include? self[1] + kind = self[1].to_sym + else + kind = :unknown + end + + opened_tokens << kind + case self[2] + when '<' + encoder.begin_group kind + when '[' + encoder.begin_line kind + else + raise 'CodeRay bug: This case should not be reached.' + end + + elsif !opened_tokens.empty? && match = scan(/ > /x) + encoder.end_group opened_tokens.pop + + elsif !opened_tokens.empty? && match = scan(/ \] /x) + encoder.end_line opened_tokens.pop + + else + encoder.text_token getch, :space + + end + + end + + encoder.end_group opened_tokens.pop until opened_tokens.empty? + + encoder + end + + end + +end +end diff --git a/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/delphi.rb b/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/delphi.rb new file mode 100644 index 0000000..b328155 --- /dev/null +++ b/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/delphi.rb @@ -0,0 +1,144 @@ +module CodeRay +module Scanners + + # Scanner for the Delphi language (Object Pascal). + # + # Alias: +pascal+ + class Delphi < Scanner + + register_for :delphi + file_extension 'pas' + + KEYWORDS = [ + 'and', 'array', 'as', 'at', 'asm', 'at', 'begin', 'case', 'class', + 'const', 'constructor', 'destructor', 'dispinterface', 'div', 'do', + 'downto', 'else', 'end', 'except', 'exports', 'file', 'finalization', + 'finally', 'for', 'function', 'goto', 'if', 'implementation', 'in', + 'inherited', 'initialization', 'inline', 'interface', 'is', 'label', + 'library', 'mod', 'nil', 'not', 'object', 'of', 'or', 'out', 'packed', + 'procedure', 'program', 'property', 'raise', 'record', 'repeat', + 'resourcestring', 'set', 'shl', 'shr', 'string', 'then', 'threadvar', + 'to', 'try', 'type', 'unit', 'until', 'uses', 'var', 'while', 'with', + 'xor', 'on', + ] # :nodoc: + + DIRECTIVES = [ + 'absolute', 'abstract', 'assembler', 'at', 'automated', 'cdecl', + 'contains', 'deprecated', 'dispid', 'dynamic', 'export', + 'external', 'far', 'forward', 'implements', 'local', + 'near', 'nodefault', 'on', 'overload', 'override', + 'package', 'pascal', 'platform', 'private', 'protected', 'public', + 'published', 'read', 'readonly', 'register', 'reintroduce', + 'requires', 'resident', 'safecall', 'stdcall', 'stored', 'varargs', + 'virtual', 'write', 'writeonly', + ] # :nodoc: + + IDENT_KIND = WordList::CaseIgnoring.new(:ident). + add(KEYWORDS, :keyword). + add(DIRECTIVES, :directive) # :nodoc: + + NAME_FOLLOWS = WordList::CaseIgnoring.new(false). + add(%w(procedure function .)) # :nodoc: + + protected + + def scan_tokens encoder, options + + state = :initial + last_token = '' + + until eos? + + if state == :initial + + if match = scan(/ \s+ /x) + encoder.text_token match, :space + next + + elsif match = scan(%r! \{ \$ [^}]* \}? | \(\* \$ (?: .*? \*\) | .* ) !mx) + encoder.text_token match, :preprocessor + next + + elsif match = scan(%r! // [^\n]* | \{ [^}]* \}? | \(\* (?: .*? \*\) | .* ) !mx) + encoder.text_token match, :comment + next + + elsif match = scan(/ <[>=]? | >=? | :=? | [-+=*\/;,@\^|\(\)\[\]] | \.\. /x) + encoder.text_token match, :operator + + elsif match = scan(/\./) + encoder.text_token match, :operator + next if last_token == 'end' + + elsif match = scan(/ [A-Za-z_][A-Za-z_0-9]* /x) + encoder.text_token match, NAME_FOLLOWS[last_token] ? :ident : IDENT_KIND[match] + + elsif match = skip(/ ' ( [^\n']|'' ) (?:'|$) /x) + encoder.begin_group :char + encoder.text_token "'", :delimiter + encoder.text_token self[1], :content + encoder.text_token "'", :delimiter + encoder.end_group :char + next + + elsif match = scan(/ ' /x) + encoder.begin_group :string + encoder.text_token match, :delimiter + state = :string + + elsif match = scan(/ \# (?: \d+ | \$[0-9A-Fa-f]+ ) /x) + encoder.text_token match, :char + + elsif match = scan(/ \$ [0-9A-Fa-f]+ /x) + encoder.text_token match, :hex + + elsif match = scan(/ (?: \d+ ) (?![eE]|\.[^.]) /x) + encoder.text_token match, :integer + + elsif match = scan(/ \d+ (?: \.\d+ (?: [eE][+-]? \d+ )? | [eE][+-]? \d+ ) /x) + encoder.text_token match, :float + + else + encoder.text_token getch, :error + next + + end + + elsif state == :string + if match = scan(/[^\n']+/) + encoder.text_token match, :content + elsif match = scan(/''/) + encoder.text_token match, :char + elsif match = scan(/'/) + encoder.text_token match, :delimiter + encoder.end_group :string + state = :initial + next + elsif match = scan(/\n/) + encoder.end_group :string + encoder.text_token match, :space + state = :initial + else + raise "else case \' reached; %p not handled." % peek(1), encoder + end + + else + raise 'else-case reached', encoder + + end + + last_token = match + + end + + if state == :string + encoder.end_group state + end + + encoder + end + + end + +end +end diff --git a/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/diff.rb b/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/diff.rb new file mode 100644 index 0000000..fd1aed6 --- /dev/null +++ b/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/diff.rb @@ -0,0 +1,221 @@ +module CodeRay +module Scanners + + # Scanner for output of the diff command. + # + # Alias: +patch+ + class Diff < Scanner + + register_for :diff + title 'diff output' + + DEFAULT_OPTIONS = { + :highlight_code => true, + :inline_diff => true, + } + + protected + + def scan_tokens encoder, options + + line_kind = nil + state = :initial + deleted_lines_count = 0 + scanners = Hash.new do |h, lang| + h[lang] = Scanners[lang].new '', :keep_tokens => true, :keep_state => true + end + content_scanner = scanners[:plain] + content_scanner_entry_state = nil + + until eos? + + if match = scan(/\n/) + deleted_lines_count = 0 unless line_kind == :delete + if line_kind + encoder.end_line line_kind + line_kind = nil + end + encoder.text_token match, :space + next + end + + case state + + when :initial + if match = scan(/--- |\+\+\+ |=+|_+/) + encoder.begin_line line_kind = :head + encoder.text_token match, :head + if match = scan(/[^\x00\n]+?(?=$|[\t\n]| \(revision)/) + encoder.text_token match, :filename + if options[:highlight_code] && match != '/dev/null' + file_type = CodeRay::FileType.fetch(match, :text) + file_type = :text if file_type == :diff + content_scanner = scanners[file_type] + content_scanner_entry_state = nil + end + end + next unless match = scan(/.+/) + encoder.text_token match, :plain + elsif match = scan(/Index: |Property changes on: /) + encoder.begin_line line_kind = :head + encoder.text_token match, :head + next unless match = scan(/.+/) + encoder.text_token match, :plain + elsif match = scan(/Added: /) + encoder.begin_line line_kind = :head + encoder.text_token match, :head + next unless match = scan(/.+/) + encoder.text_token match, :plain + state = :added + elsif match = scan(/\\ .*/) + encoder.text_token match, :comment + elsif match = scan(/@@(?>[^@\n]+)@@/) + content_scanner.state = :initial unless match?(/\n\+/) + content_scanner_entry_state = nil + if check(/\n|$/) + encoder.begin_line line_kind = :change + else + encoder.begin_group :change + end + encoder.text_token match[0,2], :change + encoder.text_token match[2...-2], :plain + encoder.text_token match[-2,2], :change + encoder.end_group :change unless line_kind + next unless match = scan(/.+/) + if options[:highlight_code] + content_scanner.tokenize match, :tokens => encoder + else + encoder.text_token match, :plain + end + next + elsif match = scan(/\+/) + encoder.begin_line line_kind = :insert + encoder.text_token match, :insert + next unless match = scan(/.+/) + if options[:highlight_code] + content_scanner.tokenize match, :tokens => encoder + else + encoder.text_token match, :plain + end + next + elsif match = scan(/-/) + deleted_lines_count += 1 + if options[:inline_diff] && deleted_lines_count == 1 && (changed_lines_count = 1 + check(/.*(?:\n\-.*)*/).count("\n")) && match?(/(?>.*(?:\n\-.*){#{changed_lines_count - 1}}(?:\n\+.*){#{changed_lines_count}})$(?!\n\+)/) + deleted_lines = Array.new(changed_lines_count) { |i| skip(/\n\-/) if i > 0; scan(/.*/) } + inserted_lines = Array.new(changed_lines_count) { |i| skip(/\n\+/) ; scan(/.*/) } + + deleted_lines_tokenized = [] + inserted_lines_tokenized = [] + for deleted_line, inserted_line in deleted_lines.zip(inserted_lines) + pre, deleted_part, inserted_part, post = diff deleted_line, inserted_line + content_scanner_entry_state = content_scanner.state + deleted_lines_tokenized << content_scanner.tokenize([pre, deleted_part, post], :tokens => Tokens.new) + content_scanner.state = content_scanner_entry_state || :initial + inserted_lines_tokenized << content_scanner.tokenize([pre, inserted_part, post], :tokens => Tokens.new) + end + + for pre, deleted_part, post in deleted_lines_tokenized + encoder.begin_line :delete + encoder.text_token '-', :delete + encoder.tokens pre + unless deleted_part.empty? + encoder.begin_group :eyecatcher + encoder.tokens deleted_part + encoder.end_group :eyecatcher + end + encoder.tokens post + encoder.end_line :delete + encoder.text_token "\n", :space + end + + for pre, inserted_part, post in inserted_lines_tokenized + encoder.begin_line :insert + encoder.text_token '+', :insert + encoder.tokens pre + unless inserted_part.empty? + encoder.begin_group :eyecatcher + encoder.tokens inserted_part + encoder.end_group :eyecatcher + end + encoder.tokens post + changed_lines_count -= 1 + if changed_lines_count > 0 + encoder.end_line :insert + encoder.text_token "\n", :space + end + end + + line_kind = :insert + + elsif match = scan(/.*/) + encoder.begin_line line_kind = :delete + encoder.text_token '-', :delete + if options[:highlight_code] + if deleted_lines_count == 1 + content_scanner_entry_state = content_scanner.state + end + content_scanner.tokenize match, :tokens => encoder unless match.empty? + if !match?(/\n-/) + if match?(/\n\+/) + content_scanner.state = content_scanner_entry_state || :initial + end + content_scanner_entry_state = nil + end + else + encoder.text_token match, :plain + end + end + next + elsif match = scan(/ .*/) + if options[:highlight_code] + content_scanner.tokenize match, :tokens => encoder + else + encoder.text_token match, :plain + end + next + elsif match = scan(/.+/) + encoder.begin_line line_kind = :comment + encoder.text_token match, :plain + else + raise_inspect 'else case rached' + end + + when :added + if match = scan(/ \+/) + encoder.begin_line line_kind = :insert + encoder.text_token match, :insert + next unless match = scan(/.+/) + encoder.text_token match, :plain + else + state = :initial + next + end + end + + end + + encoder.end_line line_kind if line_kind + + encoder + end + + private + + def diff a, b + # i will be the index of the leftmost difference from the left. + i_max = [a.size, b.size].min + i = 0 + i += 1 while i < i_max && a[i] == b[i] + # j_min will be the index of the leftmost difference from the right. + j_min = i - i_max + # j will be the index of the rightmost difference from the right which + # does not precede the leftmost one from the left. + j = -1 + j -= 1 while j >= j_min && a[j] == b[j] + return a[0...i], a[i..j], b[i..j], (j < -1) ? a[j+1..-1] : '' + end + + end + +end +end diff --git a/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/erb.rb b/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/erb.rb new file mode 100644 index 0000000..727a993 --- /dev/null +++ b/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/erb.rb @@ -0,0 +1,81 @@ +module CodeRay +module Scanners + + load :html + load :ruby + + # Scanner for HTML ERB templates. + class ERB < Scanner + + register_for :erb + title 'HTML ERB Template' + + KINDS_NOT_LOC = HTML::KINDS_NOT_LOC + + ERB_RUBY_BLOCK = / + (<%(?!%)[-=\#]?) + ((?> + [^\-%]* # normal* + (?> # special + (?: %(?!>) | -(?!%>) ) + [^\-%]* # normal* + )* + )) + ((?: -?%> )?) + /x # :nodoc: + + START_OF_ERB = / + <%(?!%) + /x # :nodoc: + + protected + + def setup + @ruby_scanner = CodeRay.scanner :ruby, :tokens => @tokens, :keep_tokens => true + @html_scanner = CodeRay.scanner :html, :tokens => @tokens, :keep_tokens => true, :keep_state => true + end + + def reset_instance + super + @html_scanner.reset + end + + def scan_tokens encoder, options + + until eos? + + if (match = scan_until(/(?=#{START_OF_ERB})/o) || scan_rest) and not match.empty? + @html_scanner.tokenize match, :tokens => encoder + + elsif match = scan(/#{ERB_RUBY_BLOCK}/o) + start_tag = self[1] + code = self[2] + end_tag = self[3] + + encoder.begin_group :inline + encoder.text_token start_tag, :inline_delimiter + + if start_tag == '<%#' + encoder.text_token code, :comment + else + @ruby_scanner.tokenize code, :tokens => encoder + end unless code.empty? + + encoder.text_token end_tag, :inline_delimiter unless end_tag.empty? + encoder.end_group :inline + + else + raise_inspect 'else-case reached!', encoder + + end + + end + + encoder + + end + + end + +end +end diff --git a/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/go.rb b/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/go.rb new file mode 100644 index 0000000..99fdd63 --- /dev/null +++ b/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/go.rb @@ -0,0 +1,208 @@ +module CodeRay +module Scanners + + class Go < Scanner + + register_for :go + file_extension 'go' + + # http://golang.org/ref/spec#Keywords + KEYWORDS = [ + 'break', 'default', 'func', 'interface', 'select', + 'case', 'defer', 'go', 'map', 'struct', + 'chan', 'else', 'goto', 'package', 'switch', + 'const', 'fallthrough', 'if', 'range', 'type', + 'continue', 'for', 'import', 'return', 'var', + ] # :nodoc: + + # http://golang.org/ref/spec#Types + PREDEFINED_TYPES = [ + 'bool', + 'uint8', 'uint16', 'uint32', 'uint64', + 'int8', 'int16', 'int32', 'int64', + 'float32', 'float64', + 'complex64', 'complex128', + 'byte', 'rune', 'string', 'error', + 'uint', 'int', 'uintptr', + ] # :nodoc: + + PREDEFINED_CONSTANTS = [ + 'nil', 'iota', + 'true', 'false', + ] # :nodoc: + + PREDEFINED_FUNCTIONS = %w[ + append cap close complex copy delete imag len + make new panic print println real recover + ] # :nodoc: + + IDENT_KIND = WordList.new(:ident). + add(KEYWORDS, :keyword). + add(PREDEFINED_TYPES, :predefined_type). + add(PREDEFINED_CONSTANTS, :predefined_constant). + add(PREDEFINED_FUNCTIONS, :predefined) # :nodoc: + + ESCAPE = / [rbfntv\n\\'"] | x[a-fA-F0-9]{1,2} | [0-7]{1,3} /x # :nodoc: + UNICODE_ESCAPE = / u[a-fA-F0-9]{4} | U[a-fA-F0-9]{8} /x # :nodoc: + + protected + + def scan_tokens encoder, options + + state = :initial + label_expected = true + case_expected = false + label_expected_before_preproc_line = nil + in_preproc_line = false + + until eos? + + case state + + when :initial + + if match = scan(/ \s+ | \\\n /x) + if in_preproc_line && match != "\\\n" && match.index(?\n) + in_preproc_line = false + case_expected = false + label_expected = label_expected_before_preproc_line + end + encoder.text_token match, :space + + elsif match = scan(%r! // [^\n\\]* (?: \\. [^\n\\]* )* | /\* (?: .*? \*/ | .* ) !mx) + encoder.text_token match, :comment + + elsif match = scan(/ - (?![\d.]) | [+*=<>?:;,!&^|()\[\]{}~%]+ | \/=? | \.(?!\d) /x) + if case_expected + label_expected = true if match == ':' + case_expected = false + end + encoder.text_token match, :operator + + elsif match = scan(/ [A-Za-z_][A-Za-z_0-9]* /x) + kind = IDENT_KIND[match] + if kind == :ident && label_expected && !in_preproc_line && scan(/:(?!:)/) + kind = :label + label_expected = false + match << matched + else + label_expected = false + if kind == :keyword + case match + when 'case', 'default' + case_expected = true + end + end + end + encoder.text_token match, kind + + elsif match = scan(/L?"/) + encoder.begin_group :string + if match[0] == ?L + encoder.text_token 'L', :modifier + match = '"' + end + encoder.text_token match, :delimiter + state = :string + + elsif match = scan(/ ` ([^`]+)? (`)? /x) + encoder.begin_group :shell + encoder.text_token '`', :delimiter + encoder.text_token self[1], :content if self[1] + encoder.text_token self[2], :delimiter if self[2] + encoder.end_group :shell + + elsif match = scan(/ \# \s* if \s* 0 /x) + match << scan_until(/ ^\# (?:elif|else|endif) .*? $ | \z /xm) unless eos? + encoder.text_token match, :comment + + elsif match = scan(/#[ \t]*(\w*)/) + encoder.text_token match, :preprocessor + in_preproc_line = true + label_expected_before_preproc_line = label_expected + state = :include_expected if self[1] == 'include' + + elsif match = scan(/ L?' (?: [^\'\n\\] | \\ (?: #{ESCAPE} | #{UNICODE_ESCAPE} ) )? '? /ox) + label_expected = false + encoder.text_token match, :char + + elsif match = scan(/\$/) + encoder.text_token match, :ident + + elsif match = scan(/-?\d*(\.\d*)?([eE][+-]?\d+)?i/) + label_expected = false + encoder.text_token match, :imaginary + + elsif match = scan(/-?0[xX][0-9A-Fa-f]+/) + label_expected = false + encoder.text_token match, :hex + + elsif match = scan(/-?(?:0[0-7]+)(?![89.eEfF])/) + label_expected = false + encoder.text_token match, :octal + + elsif match = scan(/-?(?:\d*\.\d+|\d+\.)(?:[eE][+-]?\d+)?|\d+[eE][+-]?\d+/) + label_expected = false + encoder.text_token match, :float + + elsif match = scan(/-?(?:\d+)(?![.eEfF])L?L?/) + label_expected = false + encoder.text_token match, :integer + + else + encoder.text_token getch, :error + + end + + when :string + if match = scan(/[^\\\n"]+/) + encoder.text_token match, :content + elsif match = scan(/"/) + encoder.text_token match, :delimiter + encoder.end_group :string + state = :initial + label_expected = false + elsif match = scan(/ \\ (?: #{ESCAPE} | #{UNICODE_ESCAPE} ) /mox) + encoder.text_token match, :char + elsif match = scan(/ \\ /x) + encoder.text_token match, :error + elsif match = scan(/$/) + encoder.end_group :string + state = :initial + label_expected = false + else + raise_inspect "else case \" reached; %p not handled." % peek(1), encoder + end + + when :include_expected + if match = scan(/<[^>\n]+>?|"[^"\n\\]*(?:\\.[^"\n\\]*)*"?/) + encoder.text_token match, :include + state = :initial + + elsif match = scan(/\s+/) + encoder.text_token match, :space + state = :initial if match.index ?\n + + else + state = :initial + + end + + else + raise_inspect 'Unknown state', encoder + + end + + end + + if state == :string + encoder.end_group :string + end + + encoder + end + + end + +end +end diff --git a/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/groovy.rb b/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/groovy.rb new file mode 100644 index 0000000..c64454f --- /dev/null +++ b/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/groovy.rb @@ -0,0 +1,268 @@ +module CodeRay +module Scanners + + load :java + + # Scanner for Groovy. + class Groovy < Java + + register_for :groovy + + # TODO: check list of keywords + GROOVY_KEYWORDS = %w[ + as assert def in + ] # :nodoc: + KEYWORDS_EXPECTING_VALUE = WordList.new.add %w[ + case instanceof new return throw typeof while as assert in + ] # :nodoc: + GROOVY_MAGIC_VARIABLES = %w[ it ] # :nodoc: + + IDENT_KIND = Java::IDENT_KIND.dup. + add(GROOVY_KEYWORDS, :keyword). + add(GROOVY_MAGIC_VARIABLES, :local_variable) # :nodoc: + + ESCAPE = / [bfnrtv$\n\\'"] | x[a-fA-F0-9]{1,2} | [0-7]{1,3} /x # :nodoc: + UNICODE_ESCAPE = / u[a-fA-F0-9]{4} /x # :nodoc: no 4-byte unicode chars? U[a-fA-F0-9]{8} + REGEXP_ESCAPE = / [bfnrtv\n\\'"] | x[a-fA-F0-9]{1,2} | [0-7]{1,3} | \d | [bBdDsSwW\/] /x # :nodoc: + + # TODO: interpretation inside ', ", / + STRING_CONTENT_PATTERN = { + "'" => /(?>\\[^\\'\n]+|[^\\'\n]+)+/, + '"' => /[^\\$"\n]+/, + "'''" => /(?>[^\\']+|'(?!''))+/, + '"""' => /(?>[^\\$"]+|"(?!""))+/, + '/' => /[^\\$\/\n]+/, + } # :nodoc: + + protected + + def setup + @state = :initial + end + + def scan_tokens encoder, options + state = options[:state] || @state + inline_block_stack = [] + inline_block_paren_depth = nil + string_delimiter = nil + import_clause = class_name_follows = last_token = after_def = false + value_expected = true + + until eos? + + case state + + when :initial + + if match = scan(/ \s+ | \\\n /x) + encoder.text_token match, :space + if match.index ?\n + import_clause = after_def = false + value_expected = true unless value_expected + end + next + + elsif match = scan(%r! // [^\n\\]* (?: \\. [^\n\\]* )* | /\* (?: .*? \*/ | .* ) !mx) + value_expected = true + after_def = false + encoder.text_token match, :comment + + elsif bol? && match = scan(/ \#!.* /x) + encoder.text_token match, :doctype + + elsif import_clause && match = scan(/ (?!as) #{IDENT} (?: \. #{IDENT} )* (?: \.\* )? /ox) + after_def = value_expected = false + encoder.text_token match, :include + + elsif match = scan(/ #{IDENT} | \[\] /ox) + kind = IDENT_KIND[match] + value_expected = (kind == :keyword) && KEYWORDS_EXPECTING_VALUE[match] + if last_token == '.' + kind = :ident + elsif class_name_follows + kind = :class + class_name_follows = false + elsif after_def && check(/\s*[({]/) + kind = :method + after_def = false + elsif kind == :ident && last_token != '?' && check(/:/) + kind = :key + else + class_name_follows = true if match == 'class' || (import_clause && match == 'as') + import_clause = match == 'import' + after_def = true if match == 'def' + end + encoder.text_token match, kind + + elsif match = scan(/;/) + import_clause = after_def = false + value_expected = true + encoder.text_token match, :operator + + elsif match = scan(/\{/) + class_name_follows = after_def = false + value_expected = true + encoder.text_token match, :operator + if !inline_block_stack.empty? + inline_block_paren_depth += 1 + end + + # TODO: ~'...', ~"..." and ~/.../ style regexps + elsif match = scan(/ \.\. | \*?\.(?!\d)@? | \.& | \?:? | [,?:(\[] | -[->] | \+\+ | + && | \|\| | \*\*=? | ==?~ | <=?>? | [-+*%^~&|>=!]=? | <<=? | >>>?=? /x) + value_expected = true + value_expected = :regexp if match == '~' + after_def = false + encoder.text_token match, :operator + + elsif match = scan(/ [)\]}] /x) + value_expected = after_def = false + if !inline_block_stack.empty? && match == '}' + inline_block_paren_depth -= 1 + if inline_block_paren_depth == 0 # closing brace of inline block reached + encoder.text_token match, :inline_delimiter + encoder.end_group :inline + state, string_delimiter, inline_block_paren_depth = inline_block_stack.pop + next + end + end + encoder.text_token match, :operator + + elsif check(/[\d.]/) + after_def = value_expected = false + if match = scan(/0[xX][0-9A-Fa-f]+/) + encoder.text_token match, :hex + elsif match = scan(/(?>0[0-7]+)(?![89.eEfF])/) + encoder.text_token match, :octal + elsif match = scan(/\d+[fFdD]|\d*\.\d+(?:[eE][+-]?\d+)?[fFdD]?|\d+[eE][+-]?\d+[fFdD]?/) + encoder.text_token match, :float + elsif match = scan(/\d+[lLgG]?/) + encoder.text_token match, :integer + end + + elsif match = scan(/'''|"""/) + after_def = value_expected = false + state = :multiline_string + encoder.begin_group :string + string_delimiter = match + encoder.text_token match, :delimiter + + # TODO: record.'name' syntax + elsif match = scan(/["']/) + after_def = value_expected = false + state = match == '/' ? :regexp : :string + encoder.begin_group state + string_delimiter = match + encoder.text_token match, :delimiter + + elsif value_expected && match = scan(/\//) + after_def = value_expected = false + encoder.begin_group :regexp + state = :regexp + string_delimiter = '/' + encoder.text_token match, :delimiter + + elsif match = scan(/ @ #{IDENT} /ox) + after_def = value_expected = false + encoder.text_token match, :annotation + + elsif match = scan(/\//) + after_def = false + value_expected = true + encoder.text_token match, :operator + + else + encoder.text_token getch, :error + + end + + when :string, :regexp, :multiline_string + if match = scan(STRING_CONTENT_PATTERN[string_delimiter]) + encoder.text_token match, :content + + elsif match = scan(state == :multiline_string ? /'''|"""/ : /["'\/]/) + encoder.text_token match, :delimiter + if state == :regexp + # TODO: regexp modifiers? s, m, x, i? + modifiers = scan(/[ix]+/) + encoder.text_token modifiers, :modifier if modifiers && !modifiers.empty? + end + state = :string if state == :multiline_string + encoder.end_group state + string_delimiter = nil + after_def = value_expected = false + state = :initial + next + + elsif (state == :string || state == :multiline_string) && + (match = scan(/ \\ (?: #{ESCAPE} | #{UNICODE_ESCAPE} ) /mox)) + if string_delimiter[0] == ?' && !(match == "\\\\" || match == "\\'") + encoder.text_token match, :content + else + encoder.text_token match, :char + end + elsif state == :regexp && match = scan(/ \\ (?: #{REGEXP_ESCAPE} | #{UNICODE_ESCAPE} ) /mox) + encoder.text_token match, :char + + elsif match = scan(/ \$ #{IDENT} /mox) + encoder.begin_group :inline + encoder.text_token '$', :inline_delimiter + match = match[1..-1] + encoder.text_token match, IDENT_KIND[match] + encoder.end_group :inline + next + elsif match = scan(/ \$ \{ /x) + encoder.begin_group :inline + encoder.text_token match, :inline_delimiter + inline_block_stack << [state, string_delimiter, inline_block_paren_depth] + inline_block_paren_depth = 1 + state = :initial + next + + elsif match = scan(/ \$ /mx) + encoder.text_token match, :content + + elsif match = scan(/ \\. /mx) + encoder.text_token match, :content # TODO: Shouldn't this be :error? + + elsif match = scan(/ \\ | \n /x) + encoder.end_group state == :regexp ? :regexp : :string + encoder.text_token match, :error + after_def = value_expected = false + state = :initial + + else + raise_inspect "else case \" reached; %p not handled." % peek(1), encoder + + end + + else + raise_inspect 'Unknown state', encoder + + end + + last_token = match unless [:space, :comment, :doctype].include? kind + + end + + if [:multiline_string, :string, :regexp].include? state + encoder.end_group state == :regexp ? :regexp : :string + end + + if options[:keep_state] + @state = state + end + + until inline_block_stack.empty? + state, = *inline_block_stack.pop + encoder.end_group :inline + encoder.end_group state == :regexp ? :regexp : :string + end + + encoder + end + + end + +end +end diff --git a/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/haml.rb b/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/haml.rb new file mode 100644 index 0000000..5433790 --- /dev/null +++ b/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/haml.rb @@ -0,0 +1,168 @@ +module CodeRay +module Scanners + + load :ruby + load :html + load :java_script + + class HAML < Scanner + + register_for :haml + title 'HAML Template' + + KINDS_NOT_LOC = HTML::KINDS_NOT_LOC + + protected + + def setup + super + @ruby_scanner = CodeRay.scanner :ruby, :tokens => @tokens, :keep_tokens => true + @embedded_ruby_scanner = CodeRay.scanner :ruby, :tokens => @tokens, :keep_tokens => true, :state => @ruby_scanner.interpreted_string_state + @html_scanner = CodeRay.scanner :html, :tokens => @tokens, :keep_tokens => true + end + + def scan_tokens encoder, options + + match = nil + code = '' + + until eos? + + if bol? + if match = scan(/!!!.*/) + encoder.text_token match, :doctype + next + end + + if match = scan(/(?>( *)(\/(?!\[if)|-\#|:javascript|:ruby|:\w+) *)(?=\n)/) + encoder.text_token match, :comment + + code = self[2] + if match = scan(/(?:\n+#{self[1]} .*)+/) + case code + when '/', '-#' + encoder.text_token match, :comment + when ':javascript' + # TODO: recognize #{...} snippets inside JavaScript + @java_script_scanner ||= CodeRay.scanner :java_script, :tokens => @tokens, :keep_tokens => true + @java_script_scanner.tokenize match, :tokens => encoder + when ':ruby' + @ruby_scanner.tokenize match, :tokens => encoder + when /:\w+/ + encoder.text_token match, :comment + else + raise 'else-case reached: %p' % [code] + end + end + end + + if match = scan(/ +/) + encoder.text_token match, :space + end + + if match = scan(/\/.*/) + encoder.text_token match, :comment + next + end + + if match = scan(/\\/) + encoder.text_token match, :plain + if match = scan(/.+/) + @html_scanner.tokenize match, :tokens => encoder + end + next + end + + tag = false + + if match = scan(/%[\w:]+\/?/) + encoder.text_token match, :tag + # if match = scan(/( +)(.+)/) + # encoder.text_token self[1], :space + # @embedded_ruby_scanner.tokenize self[2], :tokens => encoder + # end + tag = true + end + + while match = scan(/([.#])[-\w]*\w/) + encoder.text_token match, self[1] == '#' ? :constant : :class + tag = true + end + + if tag && match = scan(/(\()([^)]+)?(\))?/) + # TODO: recognize title=@title, class="widget_#{@widget.number}" + encoder.text_token self[1], :plain + @html_scanner.tokenize self[2], :tokens => encoder, :state => :attribute if self[2] + encoder.text_token self[3], :plain if self[3] + end + + if tag && match = scan(/\{/) + encoder.text_token match, :plain + + code = '' + level = 1 + while true + code << scan(/([^\{\},\n]|, *\n?)*/) + case match = getch + when '{' + level += 1 + code << match + when '}' + level -= 1 + if level > 0 + code << match + else + break + end + when "\n", ",", nil + break + end + end + @ruby_scanner.tokenize code, :tokens => encoder unless code.empty? + + encoder.text_token match, :plain if match + end + + if tag && match = scan(/(\[)([^\]\n]+)?(\])?/) + encoder.text_token self[1], :plain + @ruby_scanner.tokenize self[2], :tokens => encoder if self[2] + encoder.text_token self[3], :plain if self[3] + end + + if tag && match = scan(/\//) + encoder.text_token match, :tag + end + + if scan(/(>?[-=]|[&!]=|(& |!)|~)( *)([^,\n\|]+(?:(, *|\|(?=.|\n.*\|$))\n?[^,\n\|]*)*)?/) + encoder.text_token self[1] + self[3], :plain + if self[4] + if self[2] + @embedded_ruby_scanner.tokenize self[4], :tokens => encoder + else + @ruby_scanner.tokenize self[4], :tokens => encoder + end + end + elsif match = scan(/((?:<|>)(?![!?\/\w]))?(.+)?/) + encoder.text_token self[1], :plain if self[1] + # TODO: recognize #{...} snippets + @html_scanner.tokenize self[2], :tokens => encoder if self[2] + end + + elsif match = scan(/.+/) + @html_scanner.tokenize match, :tokens => encoder + + end + + if match = scan(/\n/) + encoder.text_token match, :space + end + end + + encoder + + end + + end + +end +end diff --git a/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/html.rb b/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/html.rb new file mode 100644 index 0000000..ebe7b01 --- /dev/null +++ b/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/html.rb @@ -0,0 +1,275 @@ +module CodeRay +module Scanners + + # HTML Scanner + # + # Alias: +xhtml+ + # + # See also: Scanners::XML + class HTML < Scanner + + register_for :html + + KINDS_NOT_LOC = [ + :comment, :doctype, :preprocessor, + :tag, :attribute_name, :operator, + :attribute_value, :string, + :plain, :entity, :error, + ] # :nodoc: + + EVENT_ATTRIBUTES = %w( + onabort onafterprint onbeforeprint onbeforeunload onblur oncanplay + oncanplaythrough onchange onclick oncontextmenu oncuechange ondblclick + ondrag ondragdrop ondragend ondragenter ondragleave ondragover + ondragstart ondrop ondurationchange onemptied onended onerror onfocus + onformchange onforminput onhashchange oninput oninvalid onkeydown + onkeypress onkeyup onload onloadeddata onloadedmetadata onloadstart + onmessage onmousedown onmousemove onmouseout onmouseover onmouseup + onmousewheel onmove onoffline ononline onpagehide onpageshow onpause + onplay onplaying onpopstate onprogress onratechange onreadystatechange + onredo onreset onresize onscroll onseeked onseeking onselect onshow + onstalled onstorage onsubmit onsuspend ontimeupdate onundo onunload + onvolumechange onwaiting + ) + + IN_ATTRIBUTE = WordList::CaseIgnoring.new(nil). + add(EVENT_ATTRIBUTES, :script). + add(['style'], :style) + + ATTR_NAME = /[\w.:-]+/ # :nodoc: + TAG_END = /\/?>/ # :nodoc: + HEX = /[0-9a-fA-F]/ # :nodoc: + ENTITY = / + & + (?: + \w+ + | + \# + (?: + \d+ + | + x#{HEX}+ + ) + ) + ; + /ox # :nodoc: + + PLAIN_STRING_CONTENT = { + "'" => /[^&'>\n]+/, + '"' => /[^&">\n]+/, + } # :nodoc: + + def reset + super + @state = :initial + @plain_string_content = nil + end + + protected + + def setup + @state = :initial + @plain_string_content = nil + @in_tag = nil + end + + def scan_java_script encoder, code + if code && !code.empty? + @java_script_scanner ||= Scanners::JavaScript.new '', :keep_tokens => true + @java_script_scanner.tokenize code, :tokens => encoder + end + end + + def scan_css encoder, code, state = [:initial] + if code && !code.empty? + @css_scanner ||= Scanners::CSS.new '', :keep_tokens => true + @css_scanner.tokenize code, :tokens => encoder, :state => state + end + end + + def scan_tokens encoder, options + state = options[:state] || @state + plain_string_content = @plain_string_content + in_tag = @in_tag + in_attribute = nil + + encoder.begin_group :string if state == :attribute_value_string + + until eos? + + if state != :in_special_tag && match = scan(/\s+/m) + encoder.text_token match, :space + + else + + case state + + when :initial + if match = scan(//m) + encoder.text_token match[0..-4], :plain + encoder.text_token ']]>', :inline_delimiter + elsif match = scan(/.+/) + encoder.text_token match, :error + end + elsif match = scan(/|.*)/m) + encoder.text_token match, :comment + elsif match = scan(/|.*)|\]>/m) + encoder.text_token match, :doctype + elsif match = scan(/<\?xml(?:.*?\?>|.*)/m) + encoder.text_token match, :preprocessor + elsif match = scan(/<\?(?:.*?\?>|.*)/m) + encoder.text_token match, :comment + elsif match = scan(/<\/[-\w.:]*>?/m) + in_tag = nil + encoder.text_token match, :tag + elsif match = scan(/<(?:(script|style)|[-\w.:]+)(>)?/m) + encoder.text_token match, :tag + in_tag = self[1] + if self[2] + state = :in_special_tag if in_tag + else + state = :attribute + end + elsif match = scan(/[^<>&]+/) + encoder.text_token match, :plain + elsif match = scan(/#{ENTITY}/ox) + encoder.text_token match, :entity + elsif match = scan(/[<>&]/) + in_tag = nil + encoder.text_token match, :error + else + raise_inspect '[BUG] else-case reached with state %p' % [state], encoder + end + + when :attribute + if match = scan(/#{TAG_END}/o) + encoder.text_token match, :tag + in_attribute = nil + if in_tag + state = :in_special_tag + else + state = :initial + end + elsif match = scan(/#{ATTR_NAME}/o) + in_attribute = IN_ATTRIBUTE[match] + encoder.text_token match, :attribute_name + state = :attribute_equal + else + in_tag = nil + encoder.text_token getch, :error + end + + when :attribute_equal + if match = scan(/=/) #/ + encoder.text_token match, :operator + state = :attribute_value + else + state = :attribute + next + end + + when :attribute_value + if match = scan(/#{ATTR_NAME}/o) + encoder.text_token match, :attribute_value + state = :attribute + elsif match = scan(/["']/) + if in_attribute == :script || in_attribute == :style + encoder.begin_group :string + encoder.text_token match, :delimiter + if scan(/javascript:[ \t]*/) + encoder.text_token matched, :comment + end + code = scan_until(match == '"' ? /(?="|\z)/ : /(?='|\z)/) + if in_attribute == :script + scan_java_script encoder, code + else + scan_css encoder, code, [:block] + end + match = scan(/["']/) + encoder.text_token match, :delimiter if match + encoder.end_group :string + state = :attribute + in_attribute = nil + else + encoder.begin_group :string + state = :attribute_value_string + plain_string_content = PLAIN_STRING_CONTENT[match] + encoder.text_token match, :delimiter + end + elsif match = scan(/#{TAG_END}/o) + encoder.text_token match, :tag + state = :initial + else + encoder.text_token getch, :error + end + + when :attribute_value_string + if match = scan(plain_string_content) + encoder.text_token match, :content + elsif match = scan(/['"]/) + encoder.text_token match, :delimiter + encoder.end_group :string + state = :attribute + elsif match = scan(/#{ENTITY}/ox) + encoder.text_token match, :entity + elsif match = scan(/&/) + encoder.text_token match, :content + elsif match = scan(/[\n>]/) + encoder.end_group :string + state = :initial + encoder.text_token match, :error + end + + when :in_special_tag + case in_tag + when 'script', 'style' + encoder.text_token match, :space if match = scan(/[ \t]*\n/) + if scan(/(\s*)|(.*))/m) + code = self[2] || self[4] + closing = self[3] + encoder.text_token self[1], :comment + else + code = scan_until(/(?=(?:\n\s*)?<\/#{in_tag}>)|\z/) + closing = false + end + unless code.empty? + encoder.begin_group :inline + if in_tag == 'script' + scan_java_script encoder, code + else + scan_css encoder, code + end + encoder.end_group :inline + end + encoder.text_token closing, :comment if closing + state = :initial + else + raise 'unknown special tag: %p' % [in_tag] + end + + else + raise_inspect 'Unknown state: %p' % [state], encoder + + end + + end + + end + + if options[:keep_state] + @state = state + @plain_string_content = plain_string_content + @in_tag = in_tag + end + + encoder.end_group :string if state == :attribute_value_string + + encoder + end + + end + +end +end diff --git a/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/java.rb b/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/java.rb new file mode 100644 index 0000000..b282864 --- /dev/null +++ b/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/java.rb @@ -0,0 +1,174 @@ +module CodeRay +module Scanners + + # Scanner for Java. + class Java < Scanner + + register_for :java + + autoload :BuiltinTypes, CodeRay.coderay_path('scanners', 'java', 'builtin_types') + + # http://java.sun.com/docs/books/tutorial/java/nutsandbolts/_keywords.html + KEYWORDS = %w[ + assert break case catch continue default do else + finally for if instanceof import new package + return switch throw try typeof while + debugger export + ] # :nodoc: + RESERVED = %w[ const goto ] # :nodoc: + CONSTANTS = %w[ false null true ] # :nodoc: + MAGIC_VARIABLES = %w[ this super ] # :nodoc: + TYPES = %w[ + boolean byte char class double enum float int interface long + short void + ] << '[]' # :nodoc: because int[] should be highlighted as a type + DIRECTIVES = %w[ + abstract extends final implements native private protected public + static strictfp synchronized throws transient volatile + ] # :nodoc: + + IDENT_KIND = WordList.new(:ident). + add(KEYWORDS, :keyword). + add(RESERVED, :reserved). + add(CONSTANTS, :predefined_constant). + add(MAGIC_VARIABLES, :local_variable). + add(TYPES, :type). + add(BuiltinTypes::List, :predefined_type). + add(BuiltinTypes::List.select { |builtin| builtin[/(Error|Exception)$/] }, :exception). + add(DIRECTIVES, :directive) # :nodoc: + + ESCAPE = / [bfnrtv\n\\'"] | x[a-fA-F0-9]{1,2} | [0-7]{1,3} /x # :nodoc: + UNICODE_ESCAPE = / u[a-fA-F0-9]{4} | U[a-fA-F0-9]{8} /x # :nodoc: + STRING_CONTENT_PATTERN = { + "'" => /[^\\']+/, + '"' => /[^\\"]+/, + '/' => /[^\\\/]+/, + } # :nodoc: + IDENT = /[a-zA-Z_][A-Za-z_0-9]*/ # :nodoc: + + protected + + def scan_tokens encoder, options + + state = :initial + string_delimiter = nil + package_name_expected = false + class_name_follows = false + last_token_dot = false + + until eos? + + case state + + when :initial + + if match = scan(/ \s+ | \\\n /x) + encoder.text_token match, :space + next + + elsif match = scan(%r! // [^\n\\]* (?: \\. [^\n\\]* )* | /\* (?: .*? \*/ | .* ) !mx) + encoder.text_token match, :comment + next + + elsif package_name_expected && match = scan(/ #{IDENT} (?: \. #{IDENT} )* /ox) + encoder.text_token match, package_name_expected + + elsif match = scan(/ #{IDENT} | \[\] /ox) + kind = IDENT_KIND[match] + if last_token_dot + kind = :ident + elsif class_name_follows + kind = :class + class_name_follows = false + else + case match + when 'import' + package_name_expected = :include + when 'package' + package_name_expected = :namespace + when 'class', 'interface' + class_name_follows = true + end + end + encoder.text_token match, kind + + elsif match = scan(/ \.(?!\d) | [,?:()\[\]}] | -- | \+\+ | && | \|\| | \*\*=? | [-+*\/%^~&|<>=!]=? | <<=? | >>>?=? /x) + encoder.text_token match, :operator + + elsif match = scan(/;/) + package_name_expected = false + encoder.text_token match, :operator + + elsif match = scan(/\{/) + class_name_follows = false + encoder.text_token match, :operator + + elsif check(/[\d.]/) + if match = scan(/0[xX][0-9A-Fa-f]+/) + encoder.text_token match, :hex + elsif match = scan(/(?>0[0-7]+)(?![89.eEfF])/) + encoder.text_token match, :octal + elsif match = scan(/\d+[fFdD]|\d*\.\d+(?:[eE][+-]?\d+)?[fFdD]?|\d+[eE][+-]?\d+[fFdD]?/) + encoder.text_token match, :float + elsif match = scan(/\d+[lL]?/) + encoder.text_token match, :integer + end + + elsif match = scan(/["']/) + state = :string + encoder.begin_group state + string_delimiter = match + encoder.text_token match, :delimiter + + elsif match = scan(/ @ #{IDENT} /ox) + encoder.text_token match, :annotation + + else + encoder.text_token getch, :error + + end + + when :string + if match = scan(STRING_CONTENT_PATTERN[string_delimiter]) + encoder.text_token match, :content + elsif match = scan(/["'\/]/) + encoder.text_token match, :delimiter + encoder.end_group state + state = :initial + string_delimiter = nil + elsif state == :string && (match = scan(/ \\ (?: #{ESCAPE} | #{UNICODE_ESCAPE} ) /mox)) + if string_delimiter == "'" && !(match == "\\\\" || match == "\\'") + encoder.text_token match, :content + else + encoder.text_token match, :char + end + elsif match = scan(/\\./m) + encoder.text_token match, :content + elsif match = scan(/ \\ | $ /x) + encoder.end_group state + state = :initial + encoder.text_token match, :error unless match.empty? + else + raise_inspect "else case \" reached; %p not handled." % peek(1), encoder + end + + else + raise_inspect 'Unknown state', encoder + + end + + last_token_dot = match == '.' + + end + + if state == :string + encoder.end_group state + end + + encoder + end + + end + +end +end diff --git a/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/java/builtin_types.rb b/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/java/builtin_types.rb new file mode 100644 index 0000000..d1b8b73 --- /dev/null +++ b/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/java/builtin_types.rb @@ -0,0 +1,421 @@ +module CodeRay +module Scanners + + module Java::BuiltinTypes # :nodoc: + + #:nocov: + List = %w[ + AbstractAction AbstractBorder AbstractButton AbstractCellEditor AbstractCollection + AbstractColorChooserPanel AbstractDocument AbstractExecutorService AbstractInterruptibleChannel + AbstractLayoutCache AbstractList AbstractListModel AbstractMap AbstractMethodError AbstractPreferences + AbstractQueue AbstractQueuedSynchronizer AbstractSelectableChannel AbstractSelectionKey AbstractSelector + AbstractSequentialList AbstractSet AbstractSpinnerModel AbstractTableModel AbstractUndoableEdit + AbstractWriter AccessControlContext AccessControlException AccessController AccessException Accessible + AccessibleAction AccessibleAttributeSequence AccessibleBundle AccessibleComponent AccessibleContext + AccessibleEditableText AccessibleExtendedComponent AccessibleExtendedTable AccessibleExtendedText + AccessibleHyperlink AccessibleHypertext AccessibleIcon AccessibleKeyBinding AccessibleObject + AccessibleRelation AccessibleRelationSet AccessibleResourceBundle AccessibleRole AccessibleSelection + AccessibleState AccessibleStateSet AccessibleStreamable AccessibleTable AccessibleTableModelChange + AccessibleText AccessibleTextSequence AccessibleValue AccountException AccountExpiredException + AccountLockedException AccountNotFoundException Acl AclEntry AclNotFoundException Action ActionEvent + ActionListener ActionMap ActionMapUIResource Activatable ActivateFailedException ActivationDesc + ActivationException ActivationGroup ActivationGroupDesc ActivationGroupID ActivationGroup_Stub + ActivationID ActivationInstantiator ActivationMonitor ActivationSystem Activator ActiveEvent + ActivityCompletedException ActivityRequiredException Adjustable AdjustmentEvent AdjustmentListener + Adler32 AffineTransform AffineTransformOp AlgorithmParameterGenerator AlgorithmParameterGeneratorSpi + AlgorithmParameters AlgorithmParameterSpec AlgorithmParametersSpi AllPermission AlphaComposite + AlreadyBoundException AlreadyConnectedException AncestorEvent AncestorListener AnnotatedElement + Annotation AnnotationFormatError AnnotationTypeMismatchException AppConfigurationEntry Appendable Applet + AppletContext AppletInitializer AppletStub Arc2D Area AreaAveragingScaleFilter ArithmeticException Array + ArrayBlockingQueue ArrayIndexOutOfBoundsException ArrayList Arrays ArrayStoreException ArrayType + AssertionError AsyncBoxView AsynchronousCloseException AtomicBoolean AtomicInteger AtomicIntegerArray + AtomicIntegerFieldUpdater AtomicLong AtomicLongArray AtomicLongFieldUpdater AtomicMarkableReference + AtomicReference AtomicReferenceArray AtomicReferenceFieldUpdater AtomicStampedReference Attribute + AttributeChangeNotification AttributeChangeNotificationFilter AttributedCharacterIterator + AttributedString AttributeException AttributeInUseException AttributeList AttributeModificationException + AttributeNotFoundException Attributes AttributeSet AttributeSetUtilities AttributeValueExp AudioClip + AudioFileFormat AudioFileReader AudioFileWriter AudioFormat AudioInputStream AudioPermission AudioSystem + AuthenticationException AuthenticationNotSupportedException Authenticator AuthorizeCallback + AuthPermission AuthProvider Autoscroll AWTError AWTEvent AWTEventListener AWTEventListenerProxy + AWTEventMulticaster AWTException AWTKeyStroke AWTPermission BackingStoreException + BadAttributeValueExpException BadBinaryOpValueExpException BadLocationException BadPaddingException + BadStringOperationException BandCombineOp BandedSampleModel BaseRowSet BasicArrowButton BasicAttribute + BasicAttributes BasicBorders BasicButtonListener BasicButtonUI BasicCheckBoxMenuItemUI BasicCheckBoxUI + BasicColorChooserUI BasicComboBoxEditor BasicComboBoxRenderer BasicComboBoxUI BasicComboPopup + BasicControl BasicDesktopIconUI BasicDesktopPaneUI BasicDirectoryModel BasicEditorPaneUI + BasicFileChooserUI BasicFormattedTextFieldUI BasicGraphicsUtils BasicHTML BasicIconFactory + BasicInternalFrameTitlePane BasicInternalFrameUI BasicLabelUI BasicListUI BasicLookAndFeel + BasicMenuBarUI BasicMenuItemUI BasicMenuUI BasicOptionPaneUI BasicPanelUI BasicPasswordFieldUI + BasicPermission BasicPopupMenuSeparatorUI BasicPopupMenuUI BasicProgressBarUI BasicRadioButtonMenuItemUI + BasicRadioButtonUI BasicRootPaneUI BasicScrollBarUI BasicScrollPaneUI BasicSeparatorUI BasicSliderUI + BasicSpinnerUI BasicSplitPaneDivider BasicSplitPaneUI BasicStroke BasicTabbedPaneUI BasicTableHeaderUI + BasicTableUI BasicTextAreaUI BasicTextFieldUI BasicTextPaneUI BasicTextUI BasicToggleButtonUI + BasicToolBarSeparatorUI BasicToolBarUI BasicToolTipUI BasicTreeUI BasicViewportUI BatchUpdateException + BeanContext BeanContextChild BeanContextChildComponentProxy BeanContextChildSupport + BeanContextContainerProxy BeanContextEvent BeanContextMembershipEvent BeanContextMembershipListener + BeanContextProxy BeanContextServiceAvailableEvent BeanContextServiceProvider + BeanContextServiceProviderBeanInfo BeanContextServiceRevokedEvent BeanContextServiceRevokedListener + BeanContextServices BeanContextServicesListener BeanContextServicesSupport BeanContextSupport + BeanDescriptor BeanInfo Beans BevelBorder Bidi BigDecimal BigInteger BinaryRefAddr BindException Binding + BitSet Blob BlockingQueue BlockView BMPImageWriteParam Book Boolean BooleanControl Border BorderFactory + BorderLayout BorderUIResource BoundedRangeModel Box BoxLayout BoxView BreakIterator + BrokenBarrierException Buffer BufferCapabilities BufferedImage BufferedImageFilter BufferedImageOp + BufferedInputStream BufferedOutputStream BufferedReader BufferedWriter BufferOverflowException + BufferStrategy BufferUnderflowException Button ButtonGroup ButtonModel ButtonUI Byte + ByteArrayInputStream ByteArrayOutputStream ByteBuffer ByteChannel ByteLookupTable ByteOrder CachedRowSet + CacheRequest CacheResponse Calendar Callable CallableStatement Callback CallbackHandler + CancelablePrintJob CancellationException CancelledKeyException CannotProceedException + CannotRedoException CannotUndoException Canvas CardLayout Caret CaretEvent CaretListener CellEditor + CellEditorListener CellRendererPane Certificate CertificateEncodingException CertificateException + CertificateExpiredException CertificateFactory CertificateFactorySpi CertificateNotYetValidException + CertificateParsingException CertPath CertPathBuilder CertPathBuilderException CertPathBuilderResult + CertPathBuilderSpi CertPathParameters CertPathTrustManagerParameters CertPathValidator + CertPathValidatorException CertPathValidatorResult CertPathValidatorSpi CertSelector CertStore + CertStoreException CertStoreParameters CertStoreSpi ChangedCharSetException ChangeEvent ChangeListener + Channel Channels Character CharacterCodingException CharacterIterator CharArrayReader CharArrayWriter + CharBuffer CharConversionException CharSequence Charset CharsetDecoder CharsetEncoder CharsetProvider + Checkbox CheckboxGroup CheckboxMenuItem CheckedInputStream CheckedOutputStream Checksum Choice + ChoiceCallback ChoiceFormat Chromaticity Cipher CipherInputStream CipherOutputStream CipherSpi Class + ClassCastException ClassCircularityError ClassDefinition ClassDesc ClassFileTransformer ClassFormatError + ClassLoader ClassLoaderRepository ClassLoadingMXBean ClassNotFoundException Clip Clipboard + ClipboardOwner Clob Cloneable CloneNotSupportedException Closeable ClosedByInterruptException + ClosedChannelException ClosedSelectorException CMMException CoderMalfunctionError CoderResult CodeSigner + CodeSource CodingErrorAction CollationElementIterator CollationKey Collator Collection + CollectionCertStoreParameters Collections Color ColorChooserComponentFactory ColorChooserUI + ColorConvertOp ColorModel ColorSelectionModel ColorSpace ColorSupported ColorType ColorUIResource + ComboBoxEditor ComboBoxModel ComboBoxUI ComboPopup CommunicationException Comparable Comparator + CompilationMXBean Compiler CompletionService Component ComponentAdapter ComponentColorModel + ComponentEvent ComponentInputMap ComponentInputMapUIResource ComponentListener ComponentOrientation + ComponentSampleModel ComponentUI ComponentView Composite CompositeContext CompositeData + CompositeDataSupport CompositeName CompositeType CompositeView CompoundBorder CompoundControl + CompoundEdit CompoundName Compression ConcurrentHashMap ConcurrentLinkedQueue ConcurrentMap + ConcurrentModificationException Condition Configuration ConfigurationException ConfirmationCallback + ConnectException ConnectIOException Connection ConnectionEvent ConnectionEventListener + ConnectionPendingException ConnectionPoolDataSource ConsoleHandler Constructor Container + ContainerAdapter ContainerEvent ContainerListener ContainerOrderFocusTraversalPolicy ContentHandler + ContentHandlerFactory ContentModel Context ContextNotEmptyException ContextualRenderedImageFactory + Control ControlFactory ControllerEventListener ConvolveOp CookieHandler Copies CopiesSupported + CopyOnWriteArrayList CopyOnWriteArraySet CountDownLatch CounterMonitor CounterMonitorMBean CRC32 + CredentialException CredentialExpiredException CredentialNotFoundException CRL CRLException CRLSelector + CropImageFilter CSS CubicCurve2D Currency Cursor Customizer CyclicBarrier DatabaseMetaData DataBuffer + DataBufferByte DataBufferDouble DataBufferFloat DataBufferInt DataBufferShort DataBufferUShort + DataFlavor DataFormatException DatagramChannel DatagramPacket DatagramSocket DatagramSocketImpl + DatagramSocketImplFactory DataInput DataInputStream DataLine DataOutput DataOutputStream DataSource + DataTruncation DatatypeConfigurationException DatatypeConstants DatatypeFactory Date DateFormat + DateFormatSymbols DateFormatter DateTimeAtCompleted DateTimeAtCreation DateTimeAtProcessing + DateTimeSyntax DebugGraphics DecimalFormat DecimalFormatSymbols DefaultBoundedRangeModel + DefaultButtonModel DefaultCaret DefaultCellEditor DefaultColorSelectionModel DefaultComboBoxModel + DefaultDesktopManager DefaultEditorKit DefaultFocusManager DefaultFocusTraversalPolicy DefaultFormatter + DefaultFormatterFactory DefaultHighlighter DefaultKeyboardFocusManager DefaultListCellRenderer + DefaultListModel DefaultListSelectionModel DefaultLoaderRepository DefaultMenuLayout DefaultMetalTheme + DefaultMutableTreeNode DefaultPersistenceDelegate DefaultSingleSelectionModel DefaultStyledDocument + DefaultTableCellRenderer DefaultTableColumnModel DefaultTableModel DefaultTextUI DefaultTreeCellEditor + DefaultTreeCellRenderer DefaultTreeModel DefaultTreeSelectionModel Deflater DeflaterOutputStream Delayed + DelayQueue DelegationPermission Deprecated Descriptor DescriptorAccess DescriptorSupport DESedeKeySpec + DesignMode DESKeySpec DesktopIconUI DesktopManager DesktopPaneUI Destination Destroyable + DestroyFailedException DGC DHGenParameterSpec DHKey DHParameterSpec DHPrivateKey DHPrivateKeySpec + DHPublicKey DHPublicKeySpec Dialog Dictionary DigestException DigestInputStream DigestOutputStream + Dimension Dimension2D DimensionUIResource DirContext DirectColorModel DirectoryManager DirObjectFactory + DirStateFactory DisplayMode DnDConstants Doc DocAttribute DocAttributeSet DocFlavor DocPrintJob Document + DocumentBuilder DocumentBuilderFactory Documented DocumentEvent DocumentFilter DocumentListener + DocumentName DocumentParser DomainCombiner DOMLocator DOMResult DOMSource Double DoubleBuffer + DragGestureEvent DragGestureListener DragGestureRecognizer DragSource DragSourceAdapter + DragSourceContext DragSourceDragEvent DragSourceDropEvent DragSourceEvent DragSourceListener + DragSourceMotionListener Driver DriverManager DriverPropertyInfo DropTarget DropTargetAdapter + DropTargetContext DropTargetDragEvent DropTargetDropEvent DropTargetEvent DropTargetListener DSAKey + DSAKeyPairGenerator DSAParameterSpec DSAParams DSAPrivateKey DSAPrivateKeySpec DSAPublicKey + DSAPublicKeySpec DTD DTDConstants DuplicateFormatFlagsException Duration DynamicMBean ECField ECFieldF2m + ECFieldFp ECGenParameterSpec ECKey ECParameterSpec ECPoint ECPrivateKey ECPrivateKeySpec ECPublicKey + ECPublicKeySpec EditorKit Element ElementIterator ElementType Ellipse2D EllipticCurve EmptyBorder + EmptyStackException EncodedKeySpec Encoder EncryptedPrivateKeyInfo Entity Enum + EnumConstantNotPresentException EnumControl Enumeration EnumMap EnumSet EnumSyntax EOFException Error + ErrorListener ErrorManager EtchedBorder Event EventContext EventDirContext EventHandler EventListener + EventListenerList EventListenerProxy EventObject EventQueue EventSetDescriptor Exception + ExceptionInInitializerError ExceptionListener Exchanger ExecutionException Executor + ExecutorCompletionService Executors ExecutorService ExemptionMechanism ExemptionMechanismException + ExemptionMechanismSpi ExpandVetoException ExportException Expression ExtendedRequest ExtendedResponse + Externalizable FactoryConfigurationError FailedLoginException FeatureDescriptor Fidelity Field + FieldPosition FieldView File FileCacheImageInputStream FileCacheImageOutputStream FileChannel + FileChooserUI FileDescriptor FileDialog FileFilter FileHandler FileImageInputStream + FileImageOutputStream FileInputStream FileLock FileLockInterruptionException FilenameFilter FileNameMap + FileNotFoundException FileOutputStream FilePermission FileReader FileSystemView FileView FileWriter + Filter FilteredImageSource FilteredRowSet FilterInputStream FilterOutputStream FilterReader FilterWriter + Finishings FixedHeightLayoutCache FlatteningPathIterator FlavorEvent FlavorException FlavorListener + FlavorMap FlavorTable Float FloatBuffer FloatControl FlowLayout FlowView Flushable FocusAdapter + FocusEvent FocusListener FocusManager FocusTraversalPolicy Font FontFormatException FontMetrics + FontRenderContext FontUIResource Format FormatConversionProvider FormatFlagsConversionMismatchException + Formattable FormattableFlags Formatter FormatterClosedException FormSubmitEvent FormView Frame Future + FutureTask GapContent GarbageCollectorMXBean GatheringByteChannel GaugeMonitor GaugeMonitorMBean + GeneralPath GeneralSecurityException GenericArrayType GenericDeclaration GenericSignatureFormatError + GlyphJustificationInfo GlyphMetrics GlyphVector GlyphView GradientPaint GraphicAttribute Graphics + Graphics2D GraphicsConfigTemplate GraphicsConfiguration GraphicsDevice GraphicsEnvironment GrayFilter + GregorianCalendar GridBagConstraints GridBagLayout GridLayout Group Guard GuardedObject GZIPInputStream + GZIPOutputStream Handler HandshakeCompletedEvent HandshakeCompletedListener HasControls HashAttributeSet + HashDocAttributeSet HashMap HashPrintJobAttributeSet HashPrintRequestAttributeSet + HashPrintServiceAttributeSet HashSet Hashtable HeadlessException HierarchyBoundsAdapter + HierarchyBoundsListener HierarchyEvent HierarchyListener Highlighter HostnameVerifier HTML HTMLDocument + HTMLEditorKit HTMLFrameHyperlinkEvent HTMLWriter HttpRetryException HttpsURLConnection HttpURLConnection + HyperlinkEvent HyperlinkListener ICC_ColorSpace ICC_Profile ICC_ProfileGray ICC_ProfileRGB Icon + IconUIResource IconView Identity IdentityHashMap IdentityScope IIOByteBuffer IIOException IIOImage + IIOInvalidTreeException IIOMetadata IIOMetadataController IIOMetadataFormat IIOMetadataFormatImpl + IIOMetadataNode IIOParam IIOParamController IIOReadProgressListener IIOReadUpdateListener + IIOReadWarningListener IIORegistry IIOServiceProvider IIOWriteProgressListener IIOWriteWarningListener + IllegalAccessError IllegalAccessException IllegalArgumentException IllegalBlockingModeException + IllegalBlockSizeException IllegalCharsetNameException IllegalClassFormatException + IllegalComponentStateException IllegalFormatCodePointException IllegalFormatConversionException + IllegalFormatException IllegalFormatFlagsException IllegalFormatPrecisionException + IllegalFormatWidthException IllegalMonitorStateException IllegalPathStateException + IllegalSelectorException IllegalStateException IllegalThreadStateException Image ImageCapabilities + ImageConsumer ImageFilter ImageGraphicAttribute ImageIcon ImageInputStream ImageInputStreamImpl + ImageInputStreamSpi ImageIO ImageObserver ImageOutputStream ImageOutputStreamImpl ImageOutputStreamSpi + ImageProducer ImageReader ImageReaderSpi ImageReaderWriterSpi ImageReadParam ImageTranscoder + ImageTranscoderSpi ImageTypeSpecifier ImageView ImageWriteParam ImageWriter ImageWriterSpi + ImagingOpException IncompatibleClassChangeError IncompleteAnnotationException IndexColorModel + IndexedPropertyChangeEvent IndexedPropertyDescriptor IndexOutOfBoundsException Inet4Address Inet6Address + InetAddress InetSocketAddress Inflater InflaterInputStream InheritableThreadLocal Inherited + InitialContext InitialContextFactory InitialContextFactoryBuilder InitialDirContext InitialLdapContext + InlineView InputContext InputEvent InputMap InputMapUIResource InputMethod InputMethodContext + InputMethodDescriptor InputMethodEvent InputMethodHighlight InputMethodListener InputMethodRequests + InputMismatchException InputStream InputStreamReader InputSubset InputVerifier Insets InsetsUIResource + InstanceAlreadyExistsException InstanceNotFoundException InstantiationError InstantiationException + Instrument Instrumentation InsufficientResourcesException IntBuffer Integer IntegerSyntax InternalError + InternalFrameAdapter InternalFrameEvent InternalFrameFocusTraversalPolicy InternalFrameListener + InternalFrameUI InternationalFormatter InterruptedException InterruptedIOException + InterruptedNamingException InterruptibleChannel IntrospectionException Introspector + InvalidActivityException InvalidAlgorithmParameterException InvalidApplicationException + InvalidAttributeIdentifierException InvalidAttributesException InvalidAttributeValueException + InvalidClassException InvalidDnDOperationException InvalidKeyException InvalidKeySpecException + InvalidMarkException InvalidMidiDataException InvalidNameException InvalidObjectException + InvalidOpenTypeException InvalidParameterException InvalidParameterSpecException + InvalidPreferencesFormatException InvalidPropertiesFormatException InvalidRelationIdException + InvalidRelationServiceException InvalidRelationTypeException InvalidRoleInfoException + InvalidRoleValueException InvalidSearchControlsException InvalidSearchFilterException + InvalidTargetObjectTypeException InvalidTransactionException InvocationEvent InvocationHandler + InvocationTargetException IOException ItemEvent ItemListener ItemSelectable Iterable Iterator + IvParameterSpec JApplet JarEntry JarException JarFile JarInputStream JarOutputStream JarURLConnection + JButton JCheckBox JCheckBoxMenuItem JColorChooser JComboBox JComponent JdbcRowSet JDesktopPane JDialog + JEditorPane JFileChooser JFormattedTextField JFrame JInternalFrame JLabel JLayeredPane JList JMenu + JMenuBar JMenuItem JMException JMRuntimeException JMXAuthenticator JMXConnectionNotification + JMXConnector JMXConnectorFactory JMXConnectorProvider JMXConnectorServer JMXConnectorServerFactory + JMXConnectorServerMBean JMXConnectorServerProvider JMXPrincipal JMXProviderException + JMXServerErrorException JMXServiceURL JobAttributes JobHoldUntil JobImpressions JobImpressionsCompleted + JobImpressionsSupported JobKOctets JobKOctetsProcessed JobKOctetsSupported JobMediaSheets + JobMediaSheetsCompleted JobMediaSheetsSupported JobMessageFromOperator JobName JobOriginatingUserName + JobPriority JobPrioritySupported JobSheets JobState JobStateReason JobStateReasons Joinable JoinRowSet + JOptionPane JPanel JPasswordField JPEGHuffmanTable JPEGImageReadParam JPEGImageWriteParam JPEGQTable + JPopupMenu JProgressBar JRadioButton JRadioButtonMenuItem JRootPane JScrollBar JScrollPane JSeparator + JSlider JSpinner JSplitPane JTabbedPane JTable JTableHeader JTextArea JTextComponent JTextField + JTextPane JToggleButton JToolBar JToolTip JTree JViewport JWindow KerberosKey KerberosPrincipal + KerberosTicket Kernel Key KeyAdapter KeyAgreement KeyAgreementSpi KeyAlreadyExistsException + KeyboardFocusManager KeyEvent KeyEventDispatcher KeyEventPostProcessor KeyException KeyFactory + KeyFactorySpi KeyGenerator KeyGeneratorSpi KeyListener KeyManagementException KeyManager + KeyManagerFactory KeyManagerFactorySpi Keymap KeyPair KeyPairGenerator KeyPairGeneratorSpi KeyRep + KeySpec KeyStore KeyStoreBuilderParameters KeyStoreException KeyStoreSpi KeyStroke Label LabelUI + LabelView LanguageCallback LastOwnerException LayeredHighlighter LayoutFocusTraversalPolicy + LayoutManager LayoutManager2 LayoutQueue LDAPCertStoreParameters LdapContext LdapName + LdapReferralException Lease Level LimitExceededException Line Line2D LineBorder LineBreakMeasurer + LineEvent LineListener LineMetrics LineNumberInputStream LineNumberReader LineUnavailableException + LinkageError LinkedBlockingQueue LinkedHashMap LinkedHashSet LinkedList LinkException LinkLoopException + LinkRef List ListCellRenderer ListDataEvent ListDataListener ListenerNotFoundException ListIterator + ListModel ListResourceBundle ListSelectionEvent ListSelectionListener ListSelectionModel ListUI ListView + LoaderHandler Locale LocateRegistry Lock LockSupport Logger LoggingMXBean LoggingPermission LoginContext + LoginException LoginModule LogManager LogRecord LogStream Long LongBuffer LookAndFeel LookupOp + LookupTable Mac MacSpi MalformedInputException MalformedLinkException MalformedObjectNameException + MalformedParameterizedTypeException MalformedURLException ManagementFactory ManagementPermission + ManageReferralControl ManagerFactoryParameters Manifest Map MappedByteBuffer MarshalException + MarshalledObject MaskFormatter Matcher MatchResult Math MathContext MatteBorder MBeanAttributeInfo + MBeanConstructorInfo MBeanException MBeanFeatureInfo MBeanInfo MBeanNotificationInfo MBeanOperationInfo + MBeanParameterInfo MBeanPermission MBeanRegistration MBeanRegistrationException MBeanServer + MBeanServerBuilder MBeanServerConnection MBeanServerDelegate MBeanServerDelegateMBean MBeanServerFactory + MBeanServerForwarder MBeanServerInvocationHandler MBeanServerNotification MBeanServerNotificationFilter + MBeanServerPermission MBeanTrustPermission Media MediaName MediaPrintableArea MediaSize MediaSizeName + MediaTracker MediaTray Member MemoryCacheImageInputStream MemoryCacheImageOutputStream MemoryHandler + MemoryImageSource MemoryManagerMXBean MemoryMXBean MemoryNotificationInfo MemoryPoolMXBean MemoryType + MemoryUsage Menu MenuBar MenuBarUI MenuComponent MenuContainer MenuDragMouseEvent MenuDragMouseListener + MenuElement MenuEvent MenuItem MenuItemUI MenuKeyEvent MenuKeyListener MenuListener MenuSelectionManager + MenuShortcut MessageDigest MessageDigestSpi MessageFormat MetaEventListener MetalBorders MetalButtonUI + MetalCheckBoxIcon MetalCheckBoxUI MetalComboBoxButton MetalComboBoxEditor MetalComboBoxIcon + MetalComboBoxUI MetalDesktopIconUI MetalFileChooserUI MetalIconFactory MetalInternalFrameTitlePane + MetalInternalFrameUI MetalLabelUI MetalLookAndFeel MetalMenuBarUI MetalPopupMenuSeparatorUI + MetalProgressBarUI MetalRadioButtonUI MetalRootPaneUI MetalScrollBarUI MetalScrollButton + MetalScrollPaneUI MetalSeparatorUI MetalSliderUI MetalSplitPaneUI MetalTabbedPaneUI MetalTextFieldUI + MetalTheme MetalToggleButtonUI MetalToolBarUI MetalToolTipUI MetalTreeUI MetaMessage Method + MethodDescriptor MGF1ParameterSpec MidiChannel MidiDevice MidiDeviceProvider MidiEvent MidiFileFormat + MidiFileReader MidiFileWriter MidiMessage MidiSystem MidiUnavailableException MimeTypeParseException + MinimalHTMLWriter MissingFormatArgumentException MissingFormatWidthException MissingResourceException + Mixer MixerProvider MLet MLetMBean ModelMBean ModelMBeanAttributeInfo ModelMBeanConstructorInfo + ModelMBeanInfo ModelMBeanInfoSupport ModelMBeanNotificationBroadcaster ModelMBeanNotificationInfo + ModelMBeanOperationInfo ModificationItem Modifier Monitor MonitorMBean MonitorNotification + MonitorSettingException MouseAdapter MouseDragGestureRecognizer MouseEvent MouseInfo MouseInputAdapter + MouseInputListener MouseListener MouseMotionAdapter MouseMotionListener MouseWheelEvent + MouseWheelListener MultiButtonUI MulticastSocket MultiColorChooserUI MultiComboBoxUI MultiDesktopIconUI + MultiDesktopPaneUI MultiDoc MultiDocPrintJob MultiDocPrintService MultiFileChooserUI + MultiInternalFrameUI MultiLabelUI MultiListUI MultiLookAndFeel MultiMenuBarUI MultiMenuItemUI + MultiOptionPaneUI MultiPanelUI MultiPixelPackedSampleModel MultipleDocumentHandling MultipleMaster + MultiPopupMenuUI MultiProgressBarUI MultiRootPaneUI MultiScrollBarUI MultiScrollPaneUI MultiSeparatorUI + MultiSliderUI MultiSpinnerUI MultiSplitPaneUI MultiTabbedPaneUI MultiTableHeaderUI MultiTableUI + MultiTextUI MultiToolBarUI MultiToolTipUI MultiTreeUI MultiViewportUI MutableAttributeSet + MutableComboBoxModel MutableTreeNode Name NameAlreadyBoundException NameCallback NameClassPair + NameNotFoundException NameParser NamespaceChangeListener NamespaceContext Naming NamingEnumeration + NamingEvent NamingException NamingExceptionEvent NamingListener NamingManager NamingSecurityException + NavigationFilter NegativeArraySizeException NetPermission NetworkInterface NoClassDefFoundError + NoConnectionPendingException NodeChangeEvent NodeChangeListener NoInitialContextException + NoninvertibleTransformException NonReadableChannelException NonWritableChannelException + NoPermissionException NoRouteToHostException NoSuchAlgorithmException NoSuchAttributeException + NoSuchElementException NoSuchFieldError NoSuchFieldException NoSuchMethodError NoSuchMethodException + NoSuchObjectException NoSuchPaddingException NoSuchProviderException NotActiveException + NotBoundException NotCompliantMBeanException NotContextException Notification NotificationBroadcaster + NotificationBroadcasterSupport NotificationEmitter NotificationFilter NotificationFilterSupport + NotificationListener NotificationResult NotOwnerException NotSerializableException NotYetBoundException + NotYetConnectedException NullCipher NullPointerException Number NumberFormat NumberFormatException + NumberFormatter NumberOfDocuments NumberOfInterveningJobs NumberUp NumberUpSupported NumericShaper + OAEPParameterSpec Object ObjectChangeListener ObjectFactory ObjectFactoryBuilder ObjectInput + ObjectInputStream ObjectInputValidation ObjectInstance ObjectName ObjectOutput ObjectOutputStream + ObjectStreamClass ObjectStreamConstants ObjectStreamException ObjectStreamField ObjectView ObjID + Observable Observer OceanTheme OpenDataException OpenMBeanAttributeInfo OpenMBeanAttributeInfoSupport + OpenMBeanConstructorInfo OpenMBeanConstructorInfoSupport OpenMBeanInfo OpenMBeanInfoSupport + OpenMBeanOperationInfo OpenMBeanOperationInfoSupport OpenMBeanParameterInfo + OpenMBeanParameterInfoSupport OpenType OperatingSystemMXBean Operation OperationNotSupportedException + OperationsException Option OptionalDataException OptionPaneUI OrientationRequested OutOfMemoryError + OutputDeviceAssigned OutputKeys OutputStream OutputStreamWriter OverlappingFileLockException + OverlayLayout Override Owner Pack200 Package PackedColorModel Pageable PageAttributes + PagedResultsControl PagedResultsResponseControl PageFormat PageRanges PagesPerMinute PagesPerMinuteColor + Paint PaintContext PaintEvent Panel PanelUI Paper ParagraphView ParameterBlock ParameterDescriptor + ParameterizedType ParameterMetaData ParseException ParsePosition Parser ParserConfigurationException + ParserDelegator PartialResultException PasswordAuthentication PasswordCallback PasswordView Patch + PathIterator Pattern PatternSyntaxException PBEKey PBEKeySpec PBEParameterSpec PDLOverrideSupported + Permission PermissionCollection Permissions PersistenceDelegate PersistentMBean PhantomReference Pipe + PipedInputStream PipedOutputStream PipedReader PipedWriter PixelGrabber PixelInterleavedSampleModel + PKCS8EncodedKeySpec PKIXBuilderParameters PKIXCertPathBuilderResult PKIXCertPathChecker + PKIXCertPathValidatorResult PKIXParameters PlainDocument PlainView Point Point2D PointerInfo Policy + PolicyNode PolicyQualifierInfo Polygon PooledConnection Popup PopupFactory PopupMenu PopupMenuEvent + PopupMenuListener PopupMenuUI Port PortableRemoteObject PortableRemoteObjectDelegate + PortUnreachableException Position Predicate PreferenceChangeEvent PreferenceChangeListener Preferences + PreferencesFactory PreparedStatement PresentationDirection Principal Printable PrinterAbortException + PrinterException PrinterGraphics PrinterInfo PrinterIOException PrinterIsAcceptingJobs PrinterJob + PrinterLocation PrinterMakeAndModel PrinterMessageFromOperator PrinterMoreInfo + PrinterMoreInfoManufacturer PrinterName PrinterResolution PrinterState PrinterStateReason + PrinterStateReasons PrinterURI PrintEvent PrintException PrintGraphics PrintJob PrintJobAdapter + PrintJobAttribute PrintJobAttributeEvent PrintJobAttributeListener PrintJobAttributeSet PrintJobEvent + PrintJobListener PrintQuality PrintRequestAttribute PrintRequestAttributeSet PrintService + PrintServiceAttribute PrintServiceAttributeEvent PrintServiceAttributeListener PrintServiceAttributeSet + PrintServiceLookup PrintStream PrintWriter PriorityBlockingQueue PriorityQueue PrivateClassLoader + PrivateCredentialPermission PrivateKey PrivateMLet PrivilegedAction PrivilegedActionException + PrivilegedExceptionAction Process ProcessBuilder ProfileDataException ProgressBarUI ProgressMonitor + ProgressMonitorInputStream Properties PropertyChangeEvent PropertyChangeListener + PropertyChangeListenerProxy PropertyChangeSupport PropertyDescriptor PropertyEditor + PropertyEditorManager PropertyEditorSupport PropertyPermission PropertyResourceBundle + PropertyVetoException ProtectionDomain ProtocolException Provider ProviderException Proxy ProxySelector + PSource PSSParameterSpec PublicKey PushbackInputStream PushbackReader QName QuadCurve2D Query QueryEval + QueryExp Queue QueuedJobCount Random RandomAccess RandomAccessFile Raster RasterFormatException RasterOp + RC2ParameterSpec RC5ParameterSpec Rdn Readable ReadableByteChannel Reader ReadOnlyBufferException + ReadWriteLock RealmCallback RealmChoiceCallback Receiver Rectangle Rectangle2D RectangularShape + ReentrantLock ReentrantReadWriteLock Ref RefAddr Reference Referenceable ReferenceQueue + ReferenceUriSchemesSupported ReferralException ReflectionException ReflectPermission Refreshable + RefreshFailedException Region RegisterableService Registry RegistryHandler RejectedExecutionException + RejectedExecutionHandler Relation RelationException RelationNotFoundException RelationNotification + RelationService RelationServiceMBean RelationServiceNotRegisteredException RelationSupport + RelationSupportMBean RelationType RelationTypeNotFoundException RelationTypeSupport Remote RemoteCall + RemoteException RemoteObject RemoteObjectInvocationHandler RemoteRef RemoteServer RemoteStub + RenderableImage RenderableImageOp RenderableImageProducer RenderContext RenderedImage + RenderedImageFactory Renderer RenderingHints RepaintManager ReplicateScaleFilter RequestingUserName + RequiredModelMBean RescaleOp ResolutionSyntax Resolver ResolveResult ResourceBundle ResponseCache Result + ResultSet ResultSetMetaData Retention RetentionPolicy ReverbType RGBImageFilter RMIClassLoader + RMIClassLoaderSpi RMIClientSocketFactory RMIConnection RMIConnectionImpl RMIConnectionImpl_Stub + RMIConnector RMIConnectorServer RMIFailureHandler RMIIIOPServerImpl RMIJRMPServerImpl + RMISecurityException RMISecurityManager RMIServer RMIServerImpl RMIServerImpl_Stub + RMIServerSocketFactory RMISocketFactory Robot Role RoleInfo RoleInfoNotFoundException RoleList + RoleNotFoundException RoleResult RoleStatus RoleUnresolved RoleUnresolvedList RootPaneContainer + RootPaneUI RoundingMode RoundRectangle2D RowMapper RowSet RowSetEvent RowSetInternal RowSetListener + RowSetMetaData RowSetMetaDataImpl RowSetReader RowSetWarning RowSetWriter RSAKey RSAKeyGenParameterSpec + RSAMultiPrimePrivateCrtKey RSAMultiPrimePrivateCrtKeySpec RSAOtherPrimeInfo RSAPrivateCrtKey + RSAPrivateCrtKeySpec RSAPrivateKey RSAPrivateKeySpec RSAPublicKey RSAPublicKeySpec RTFEditorKit + RuleBasedCollator Runnable Runtime RuntimeErrorException RuntimeException RuntimeMBeanException + RuntimeMXBean RuntimeOperationsException RuntimePermission SampleModel Sasl SaslClient SaslClientFactory + SaslException SaslServer SaslServerFactory Savepoint SAXParser SAXParserFactory SAXResult SAXSource + SAXTransformerFactory Scanner ScatteringByteChannel ScheduledExecutorService ScheduledFuture + ScheduledThreadPoolExecutor Schema SchemaFactory SchemaFactoryLoader SchemaViolationException Scrollable + Scrollbar ScrollBarUI ScrollPane ScrollPaneAdjustable ScrollPaneConstants ScrollPaneLayout ScrollPaneUI + SealedObject SearchControls SearchResult SecretKey SecretKeyFactory SecretKeyFactorySpi SecretKeySpec + SecureCacheResponse SecureClassLoader SecureRandom SecureRandomSpi Security SecurityException + SecurityManager SecurityPermission Segment SelectableChannel SelectionKey Selector SelectorProvider + Semaphore SeparatorUI Sequence SequenceInputStream Sequencer SerialArray SerialBlob SerialClob + SerialDatalink SerialException Serializable SerializablePermission SerialJavaObject SerialRef + SerialStruct ServerCloneException ServerError ServerException ServerNotActiveException ServerRef + ServerRuntimeException ServerSocket ServerSocketChannel ServerSocketFactory ServiceNotFoundException + ServicePermission ServiceRegistry ServiceUI ServiceUIFactory ServiceUnavailableException Set + SetOfIntegerSyntax Severity Shape ShapeGraphicAttribute SheetCollate Short ShortBuffer + ShortBufferException ShortLookupTable ShortMessage Sides Signature SignatureException SignatureSpi + SignedObject Signer SimpleAttributeSet SimpleBeanInfo SimpleDateFormat SimpleDoc SimpleFormatter + SimpleTimeZone SimpleType SinglePixelPackedSampleModel SingleSelectionModel Size2DSyntax + SizeLimitExceededException SizeRequirements SizeSequence Skeleton SkeletonMismatchException + SkeletonNotFoundException SliderUI Socket SocketAddress SocketChannel SocketException SocketFactory + SocketHandler SocketImpl SocketImplFactory SocketOptions SocketPermission SocketSecurityException + SocketTimeoutException SoftBevelBorder SoftReference SortControl SortedMap SortedSet + SortingFocusTraversalPolicy SortKey SortResponseControl Soundbank SoundbankReader SoundbankResource + Source SourceDataLine SourceLocator SpinnerDateModel SpinnerListModel SpinnerModel SpinnerNumberModel + SpinnerUI SplitPaneUI Spring SpringLayout SQLData SQLException SQLInput SQLInputImpl SQLOutput + SQLOutputImpl SQLPermission SQLWarning SSLContext SSLContextSpi SSLEngine SSLEngineResult SSLException + SSLHandshakeException SSLKeyException SSLPeerUnverifiedException SSLPermission SSLProtocolException + SslRMIClientSocketFactory SslRMIServerSocketFactory SSLServerSocket SSLServerSocketFactory SSLSession + SSLSessionBindingEvent SSLSessionBindingListener SSLSessionContext SSLSocket SSLSocketFactory Stack + StackOverflowError StackTraceElement StandardMBean StartTlsRequest StartTlsResponse StateEdit + StateEditable StateFactory Statement StreamCorruptedException StreamHandler StreamPrintService + StreamPrintServiceFactory StreamResult StreamSource StreamTokenizer StrictMath String StringBuffer + StringBufferInputStream StringBuilder StringCharacterIterator StringContent + StringIndexOutOfBoundsException StringMonitor StringMonitorMBean StringReader StringRefAddr + StringSelection StringTokenizer StringValueExp StringWriter Stroke Struct Stub StubDelegate + StubNotFoundException Style StyleConstants StyleContext StyledDocument StyledEditorKit StyleSheet + Subject SubjectDelegationPermission SubjectDomainCombiner SupportedValuesAttribute SuppressWarnings + SwingConstants SwingPropertyChangeSupport SwingUtilities SyncFactory SyncFactoryException + SyncFailedException SynchronousQueue SyncProvider SyncProviderException SyncResolver SynthConstants + SynthContext Synthesizer SynthGraphicsUtils SynthLookAndFeel SynthPainter SynthStyle SynthStyleFactory + SysexMessage System SystemColor SystemFlavorMap TabableView TabbedPaneUI TabExpander TableCellEditor + TableCellRenderer TableColumn TableColumnModel TableColumnModelEvent TableColumnModelListener + TableHeaderUI TableModel TableModelEvent TableModelListener TableUI TableView TabSet TabStop TabularData + TabularDataSupport TabularType TagElement Target TargetDataLine TargetedNotification Templates + TemplatesHandler TextAction TextArea TextAttribute TextComponent TextEvent TextField TextHitInfo + TextInputCallback TextLayout TextListener TextMeasurer TextOutputCallback TextSyntax TextUI TexturePaint + Thread ThreadDeath ThreadFactory ThreadGroup ThreadInfo ThreadLocal ThreadMXBean ThreadPoolExecutor + Throwable Tie TileObserver Time TimeLimitExceededException TimeoutException Timer + TimerAlarmClockNotification TimerMBean TimerNotification TimerTask Timestamp TimeUnit TimeZone + TitledBorder ToolBarUI Toolkit ToolTipManager ToolTipUI TooManyListenersException Track + TransactionalWriter TransactionRequiredException TransactionRolledbackException Transferable + TransferHandler TransformAttribute Transformer TransformerConfigurationException TransformerException + TransformerFactory TransformerFactoryConfigurationError TransformerHandler Transmitter Transparency + TreeCellEditor TreeCellRenderer TreeExpansionEvent TreeExpansionListener TreeMap TreeModel + TreeModelEvent TreeModelListener TreeNode TreePath TreeSelectionEvent TreeSelectionListener + TreeSelectionModel TreeSet TreeUI TreeWillExpandListener TrustAnchor TrustManager TrustManagerFactory + TrustManagerFactorySpi Type TypeInfoProvider TypeNotPresentException Types TypeVariable UID UIDefaults + UIManager UIResource UndeclaredThrowableException UndoableEdit UndoableEditEvent UndoableEditListener + UndoableEditSupport UndoManager UnexpectedException UnicastRemoteObject UnknownError + UnknownFormatConversionException UnknownFormatFlagsException UnknownGroupException UnknownHostException + UnknownObjectException UnknownServiceException UnmappableCharacterException UnmarshalException + UnmodifiableClassException UnmodifiableSetException UnrecoverableEntryException + UnrecoverableKeyException Unreferenced UnresolvedAddressException UnresolvedPermission + UnsatisfiedLinkError UnsolicitedNotification UnsolicitedNotificationEvent + UnsolicitedNotificationListener UnsupportedAddressTypeException UnsupportedAudioFileException + UnsupportedCallbackException UnsupportedCharsetException UnsupportedClassVersionError + UnsupportedEncodingException UnsupportedFlavorException UnsupportedLookAndFeelException + UnsupportedOperationException URI URIException URIResolver URISyntax URISyntaxException URL + URLClassLoader URLConnection URLDecoder URLEncoder URLStreamHandler URLStreamHandlerFactory + UTFDataFormatException Util UtilDelegate Utilities UUID Validator ValidatorHandler ValueExp ValueHandler + ValueHandlerMultiFormat VariableHeightLayoutCache Vector VerifyError VetoableChangeListener + VetoableChangeListenerProxy VetoableChangeSupport View ViewFactory ViewportLayout ViewportUI + VirtualMachineError Visibility VMID VoiceStatus Void VolatileImage WeakHashMap WeakReference WebRowSet + WildcardType Window WindowAdapter WindowConstants WindowEvent WindowFocusListener WindowListener + WindowStateListener WrappedPlainView WritableByteChannel WritableRaster WritableRenderedImage + WriteAbortedException Writer X500Principal X500PrivateCredential X509Certificate X509CertSelector + X509CRL X509CRLEntry X509CRLSelector X509EncodedKeySpec X509ExtendedKeyManager X509Extension + X509KeyManager X509TrustManager XAConnection XADataSource XAException XAResource Xid XMLConstants + XMLDecoder XMLEncoder XMLFormatter XMLGregorianCalendar XMLParseException XmlReader XmlWriter XPath + XPathConstants XPathException XPathExpression XPathExpressionException XPathFactory + XPathFactoryConfigurationException XPathFunction XPathFunctionException XPathFunctionResolver + XPathVariableResolver ZipEntry ZipException ZipFile ZipInputStream ZipOutputStream ZoneView + ] + #:nocov: + + end + +end +end diff --git a/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/java_script.rb b/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/java_script.rb new file mode 100644 index 0000000..9eb0a0a --- /dev/null +++ b/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/java_script.rb @@ -0,0 +1,237 @@ +module CodeRay +module Scanners + + # Scanner for JavaScript. + # + # Aliases: +ecmascript+, +ecma_script+, +javascript+ + class JavaScript < Scanner + + register_for :java_script + file_extension 'js' + + # The actual JavaScript keywords. + KEYWORDS = %w[ + break case catch continue default delete do else + finally for function if in instanceof new + return switch throw try typeof var void while with + ] # :nodoc: + PREDEFINED_CONSTANTS = %w[ + false null true undefined NaN Infinity + ] # :nodoc: + + MAGIC_VARIABLES = %w[ this arguments ] # :nodoc: arguments was introduced in JavaScript 1.4 + + KEYWORDS_EXPECTING_VALUE = WordList.new.add %w[ + case delete in instanceof new return throw typeof with + ] # :nodoc: + + # Reserved for future use. + RESERVED_WORDS = %w[ + abstract boolean byte char class debugger double enum export extends + final float goto implements import int interface long native package + private protected public short static super synchronized throws transient + volatile + ] # :nodoc: + + IDENT_KIND = WordList.new(:ident). + add(RESERVED_WORDS, :reserved). + add(PREDEFINED_CONSTANTS, :predefined_constant). + add(MAGIC_VARIABLES, :local_variable). + add(KEYWORDS, :keyword) # :nodoc: + + ESCAPE = / [bfnrtv\n\\'"] | x[a-fA-F0-9]{1,2} | [0-7]{1,3} /x # :nodoc: + UNICODE_ESCAPE = / u[a-fA-F0-9]{4} | U[a-fA-F0-9]{8} /x # :nodoc: + REGEXP_ESCAPE = / [bBdDsSwW] /x # :nodoc: + STRING_CONTENT_PATTERN = { + "'" => /[^\\']+/, + '"' => /[^\\"]+/, + '/' => /[^\\\/]+/, + } # :nodoc: + KEY_CHECK_PATTERN = { + "'" => / (?> [^\\']* (?: \\. [^\\']* )* ) ' \s* : /mx, + '"' => / (?> [^\\"]* (?: \\. [^\\"]* )* ) " \s* : /mx, + } # :nodoc: + + protected + + def setup + @state = :initial + end + + def scan_tokens encoder, options + + state, string_delimiter = options[:state] || @state + if string_delimiter + encoder.begin_group state + end + + value_expected = true + key_expected = false + function_expected = false + + until eos? + + case state + + when :initial + + if match = scan(/ \s+ | \\\n /x) + value_expected = true if !value_expected && match.index(?\n) + encoder.text_token match, :space + + elsif match = scan(%r! // [^\n\\]* (?: \\. [^\n\\]* )* | /\* (?: .*? \*/ | .*() ) !mx) + value_expected = true + encoder.text_token match, :comment + state = :open_multi_line_comment if self[1] + + elsif check(/\.?\d/) + key_expected = value_expected = false + if match = scan(/0[xX][0-9A-Fa-f]+/) + encoder.text_token match, :hex + elsif match = scan(/(?>0[0-7]+)(?![89.eEfF])/) + encoder.text_token match, :octal + elsif match = scan(/\d+[fF]|\d*\.\d+(?:[eE][+-]?\d+)?[fF]?|\d+[eE][+-]?\d+[fF]?/) + encoder.text_token match, :float + elsif match = scan(/\d+/) + encoder.text_token match, :integer + end + + elsif value_expected && match = scan(/<([[:alpha:]]\w*) (?: [^\/>]*\/> | .*?<\/\1>)/xim) + # TODO: scan over nested tags + xml_scanner.tokenize match, :tokens => encoder + value_expected = false + next + + elsif match = scan(/ [-+*=<>?:;,!&^|(\[{~%]+ | \.(?!\d) /x) + value_expected = true + last_operator = match[-1] + key_expected = (last_operator == ?{) || (last_operator == ?,) + function_expected = false + encoder.text_token match, :operator + + elsif match = scan(/ [)\]}]+ /x) + function_expected = key_expected = value_expected = false + encoder.text_token match, :operator + + elsif match = scan(/ [$a-zA-Z_][A-Za-z_0-9$]* /x) + kind = IDENT_KIND[match] + value_expected = (kind == :keyword) && KEYWORDS_EXPECTING_VALUE[match] + # TODO: labels + if kind == :ident + if match.index(?$) # $ allowed inside an identifier + kind = :predefined + elsif function_expected + kind = :function + elsif check(/\s*[=:]\s*function\b/) + kind = :function + elsif key_expected && check(/\s*:/) + kind = :key + end + end + function_expected = (kind == :keyword) && (match == 'function') + key_expected = false + encoder.text_token match, kind + + elsif match = scan(/["']/) + if key_expected && check(KEY_CHECK_PATTERN[match]) + state = :key + else + state = :string + end + encoder.begin_group state + string_delimiter = match + encoder.text_token match, :delimiter + + elsif value_expected && (match = scan(/\//)) + encoder.begin_group :regexp + state = :regexp + string_delimiter = '/' + encoder.text_token match, :delimiter + + elsif match = scan(/ \/ /x) + value_expected = true + key_expected = false + encoder.text_token match, :operator + + else + encoder.text_token getch, :error + + end + + when :string, :regexp, :key + if match = scan(STRING_CONTENT_PATTERN[string_delimiter]) + encoder.text_token match, :content + elsif match = scan(/["'\/]/) + encoder.text_token match, :delimiter + if state == :regexp + modifiers = scan(/[gim]+/) + encoder.text_token modifiers, :modifier if modifiers && !modifiers.empty? + end + encoder.end_group state + string_delimiter = nil + key_expected = value_expected = false + state = :initial + elsif state != :regexp && (match = scan(/ \\ (?: #{ESCAPE} | #{UNICODE_ESCAPE} ) /mox)) + if string_delimiter == "'" && !(match == "\\\\" || match == "\\'") + encoder.text_token match, :content + else + encoder.text_token match, :char + end + elsif state == :regexp && match = scan(/ \\ (?: #{ESCAPE} | #{REGEXP_ESCAPE} | #{UNICODE_ESCAPE} ) /mox) + encoder.text_token match, :char + elsif match = scan(/\\./m) + encoder.text_token match, :content + elsif match = scan(/ \\ | $ /x) + encoder.end_group state + encoder.text_token match, :error unless match.empty? + string_delimiter = nil + key_expected = value_expected = false + state = :initial + else + raise_inspect "else case #{string_delimiter} reached; %p not handled." % peek(1), encoder + end + + when :open_multi_line_comment + if match = scan(%r! .*? \*/ !mx) + state = :initial + else + match = scan(%r! .+ !mx) + end + value_expected = true + encoder.text_token match, :comment if match + + else + #:nocov: + raise_inspect 'Unknown state: %p' % [state], encoder + #:nocov: + + end + + end + + if options[:keep_state] + @state = state, string_delimiter + end + + if [:string, :regexp].include? state + encoder.end_group state + end + + encoder + end + + protected + + def reset_instance + super + @xml_scanner.reset if defined? @xml_scanner + end + + def xml_scanner + @xml_scanner ||= CodeRay.scanner :xml, :tokens => @tokens, :keep_tokens => true, :keep_state => false + end + + end + +end +end diff --git a/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/json.rb b/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/json.rb new file mode 100644 index 0000000..b09970c --- /dev/null +++ b/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/json.rb @@ -0,0 +1,98 @@ +module CodeRay +module Scanners + + # Scanner for JSON (JavaScript Object Notation). + class JSON < Scanner + + register_for :json + file_extension 'json' + + KINDS_NOT_LOC = [ + :float, :char, :content, :delimiter, + :error, :integer, :operator, :value, + ] # :nodoc: + + ESCAPE = / [bfnrt\\"\/] /x # :nodoc: + UNICODE_ESCAPE = / u[a-fA-F0-9]{4} /x # :nodoc: + KEY = / (?> (?: [^\\"]+ | \\. )* ) " \s* : /x + + protected + + def setup + @state = :initial + end + + # See http://json.org/ for a definition of the JSON lexic/grammar. + def scan_tokens encoder, options + state = options[:state] || @state + + if [:string, :key].include? state + encoder.begin_group state + end + + until eos? + + case state + + when :initial + if match = scan(/ \s+ /x) + encoder.text_token match, :space + elsif match = scan(/"/) + state = check(/#{KEY}/o) ? :key : :string + encoder.begin_group state + encoder.text_token match, :delimiter + elsif match = scan(/ [:,\[{\]}] /x) + encoder.text_token match, :operator + elsif match = scan(/ true | false | null /x) + encoder.text_token match, :value + elsif match = scan(/ -? (?: 0 | [1-9]\d* ) /x) + if scan(/ \.\d+ (?:[eE][-+]?\d+)? | [eE][-+]? \d+ /x) + match << matched + encoder.text_token match, :float + else + encoder.text_token match, :integer + end + else + encoder.text_token getch, :error + end + + when :string, :key + if match = scan(/[^\\"]+/) + encoder.text_token match, :content + elsif match = scan(/"/) + encoder.text_token match, :delimiter + encoder.end_group state + state = :initial + elsif match = scan(/ \\ (?: #{ESCAPE} | #{UNICODE_ESCAPE} ) /mox) + encoder.text_token match, :char + elsif match = scan(/\\./m) + encoder.text_token match, :content + elsif match = scan(/ \\ | $ /x) + encoder.end_group state + encoder.text_token match, :error unless match.empty? + state = :initial + else + raise_inspect "else case \" reached; %p not handled." % peek(1), encoder + end + + else + raise_inspect 'Unknown state: %p' % [state], encoder + + end + end + + if options[:keep_state] + @state = state + end + + if [:string, :key].include? state + encoder.end_group state + end + + encoder + end + + end + +end +end diff --git a/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/lua.rb b/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/lua.rb new file mode 100644 index 0000000..fb1e45a --- /dev/null +++ b/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/lua.rb @@ -0,0 +1,280 @@ +# encoding: utf-8 + +module CodeRay +module Scanners + + # Scanner for the Lua[http://lua.org] programming lanuage. + # + # The language’s complete syntax is defined in + # {the Lua manual}[http://www.lua.org/manual/5.2/manual.html], + # which is what this scanner tries to conform to. + class Lua < Scanner + + register_for :lua + file_extension 'lua' + title 'Lua' + + # Keywords used in Lua. + KEYWORDS = %w[and break do else elseif end + for function goto if in + local not or repeat return + then until while + ] + + # Constants set by the Lua core. + PREDEFINED_CONSTANTS = %w[false true nil] + + # The expressions contained in this array are parts of Lua’s `basic' + # library. Although it’s not entirely necessary to load that library, + # it is highly recommended and one would have to provide own implementations + # of some of these expressions if one does not do so. They however aren’t + # keywords, neither are they constants, but nearly predefined, so they + # get tagged as `predefined' rather than anything else. + # + # This list excludes values of form `_UPPERCASE' because the Lua manual + # requires such identifiers to be reserved by Lua anyway and they are + # highlighted directly accordingly, without the need for specific + # identifiers to be listed here. + PREDEFINED_EXPRESSIONS = %w[ + assert collectgarbage dofile error getmetatable + ipairs load loadfile next pairs pcall print + rawequal rawget rawlen rawset select setmetatable + tonumber tostring type xpcall + ] + + # Automatic token kind selection for normal words. + IDENT_KIND = CodeRay::WordList.new(:ident). + add(KEYWORDS, :keyword). + add(PREDEFINED_CONSTANTS, :predefined_constant). + add(PREDEFINED_EXPRESSIONS, :predefined) + + protected + + # Scanner initialization. + def setup + @state = :initial + @brace_depth = 0 + end + + # CodeRay entry hook. Starts parsing. + def scan_tokens(encoder, options) + state = options[:state] || @state + brace_depth = @brace_depth + num_equals = nil + + until eos? + case state + + when :initial + if match = scan(/\-\-\[\=*\[/) #--[[ long (possibly multiline) comment ]] + num_equals = match.count("=") # Number must match for comment end + encoder.begin_group(:comment) + encoder.text_token(match, :delimiter) + state = :long_comment + + elsif match = scan(/--.*$/) # --Lua comment + encoder.text_token(match, :comment) + + elsif match = scan(/\[=*\[/) # [[ long (possibly multiline) string ]] + num_equals = match.count("=") # Number must match for comment end + encoder.begin_group(:string) + encoder.text_token(match, :delimiter) + state = :long_string + + elsif match = scan(/::\s*[a-zA-Z_][a-zA-Z0-9_]+\s*::/) # ::goto_label:: + encoder.text_token(match, :label) + + elsif match = scan(/_[A-Z]+/) # _UPPERCASE are names reserved for Lua + encoder.text_token(match, :predefined) + + elsif match = scan(/[a-zA-Z_][a-zA-Z0-9_]*/) # Normal letters (or letters followed by digits) + kind = IDENT_KIND[match] + + # Extra highlighting for entities following certain keywords + if kind == :keyword and match == "function" + state = :function_expected + elsif kind == :keyword and match == "goto" + state = :goto_label_expected + elsif kind == :keyword and match == "local" + state = :local_var_expected + end + + encoder.text_token(match, kind) + + elsif match = scan(/\{/) # Opening table brace { + encoder.begin_group(:map) + encoder.text_token(match, brace_depth >= 1 ? :inline_delimiter : :delimiter) + brace_depth += 1 + state = :map + + elsif match = scan(/\}/) # Closing table brace } + if brace_depth == 1 + brace_depth = 0 + encoder.text_token(match, :delimiter) + encoder.end_group(:map) + elsif brace_depth == 0 # Mismatched brace + encoder.text_token(match, :error) + else + brace_depth -= 1 + encoder.text_token(match, :inline_delimiter) + encoder.end_group(:map) + state = :map + end + + elsif match = scan(/["']/) # String delimiters " and ' + encoder.begin_group(:string) + encoder.text_token(match, :delimiter) + start_delim = match + state = :string + + # ↓Prefix hex number ←|→ decimal number + elsif match = scan(/-? (?:0x\h* \. \h+ (?:p[+\-]?\d+)? | \d*\.\d+ (?:e[+\-]?\d+)?)/ix) # hexadecimal constants have no E power, decimal ones no P power + encoder.text_token(match, :float) + + # ↓Prefix hex number ←|→ decimal number + elsif match = scan(/-? (?:0x\h+ (?:p[+\-]?\d+)? | \d+ (?:e[+\-]?\d+)?)/ix) # hexadecimal constants have no E power, decimal ones no P power + encoder.text_token(match, :integer) + + elsif match = scan(/[\+\-\*\/%^\#=~<>\(\)\[\]:;,] | \.(?!\d)/x) # Operators + encoder.text_token(match, :operator) + + elsif match = scan(/\s+/) # Space + encoder.text_token(match, :space) + + else # Invalid stuff. Note that Lua doesn’t accept multibyte chars outside of strings, hence these are also errors. + encoder.text_token(getch, :error) + end + + # It may be that we’re scanning a full-blown subexpression of a table + # (tables can contain full expressions in parts). + # If this is the case, return to :map scanning state. + state = :map if state == :initial && brace_depth >= 1 + + when :function_expected + if match = scan(/\(.*?\)/m) # x = function() # "Anonymous" function without explicit name + encoder.text_token(match, :operator) + state = :initial + elsif match = scan(/[a-zA-Z_] (?:[a-zA-Z0-9_\.] (?!\.\d))* [\.\:]/x) # function tbl.subtbl.foo() | function tbl:foo() # Colon only allowed as last separator + encoder.text_token(match, :ident) + elsif match = scan(/[a-zA-Z_][a-zA-Z0-9_]*/) # function foo() + encoder.text_token(match, :function) + state = :initial + elsif match = scan(/\s+/) # Between the `function' keyword and the ident may be any amount of whitespace + encoder.text_token(match, :space) + else + encoder.text_token(getch, :error) + state = :initial + end + + when :goto_label_expected + if match = scan(/[a-zA-Z_][a-zA-Z0-9_]*/) + encoder.text_token(match, :label) + state = :initial + elsif match = scan(/\s+/) # Between the `goto' keyword and the label may be any amount of whitespace + encoder.text_token(match, :space) + else + encoder.text_token(getch, :error) + end + + when :local_var_expected + if match = scan(/function/) # local function ... + encoder.text_token(match, :keyword) + state = :function_expected + elsif match = scan(/[a-zA-Z_][a-zA-Z0-9_]*/) + encoder.text_token(match, :local_variable) + elsif match = scan(/,/) + encoder.text_token(match, :operator) + elsif match = scan(/\=/) + encoder.text_token(match, :operator) + # After encountering the equal sign, arbitrary expressions are + # allowed again, so just return to the main state for further + # parsing. + state = :initial + elsif match = scan(/\n/) + encoder.text_token(match, :space) + state = :initial + elsif match = scan(/\s+/) + encoder.text_token(match, :space) + else + encoder.text_token(getch, :error) + end + + when :long_comment + if match = scan(/.*?(?=\]={#{num_equals}}\])/m) + encoder.text_token(match, :content) + + delim = scan(/\]={#{num_equals}}\]/) + encoder.text_token(delim, :delimiter) + else # No terminator found till EOF + encoder.text_token(rest, :error) + terminate + end + encoder.end_group(:comment) + state = :initial + + when :long_string + if match = scan(/.*?(?=\]={#{num_equals}}\])/m) # Long strings do not interpret any escape sequences + encoder.text_token(match, :content) + + delim = scan(/\]={#{num_equals}}\]/) + encoder.text_token(delim, :delimiter) + else # No terminator found till EOF + encoder.text_token(rest, :error) + terminate + end + encoder.end_group(:string) + state = :initial + + when :string + if match = scan(/[^\\#{start_delim}\n]+/) # Everything except \ and the start delimiter character is string content (newlines are only allowed if preceeded by \ or \z) + encoder.text_token(match, :content) + elsif match = scan(/\\(?:['"abfnrtv\\]|z\s*|x\h\h|\d{1,3}|\n)/m) + encoder.text_token(match, :char) + elsif match = scan(Regexp.compile(start_delim)) + encoder.text_token(match, :delimiter) + encoder.end_group(:string) + state = :initial + elsif match = scan(/\n/) # Lua forbids unescaped newlines in normal non-long strings + encoder.text_token("\\n\n", :error) # Visually appealing error indicator--otherwise users may wonder whether the highlighter cannot highlight multine strings + encoder.end_group(:string) + state = :initial + else + encoder.text_token(getch, :error) + end + + when :map + if match = scan(/[,;]/) + encoder.text_token(match, :operator) + elsif match = scan(/[a-zA-Z_][a-zA-Z0-9_]* (?=\s*=)/x) + encoder.text_token(match, :key) + encoder.text_token(scan(/\s+/), :space) if check(/\s+/) + encoder.text_token(scan(/\=/), :operator) + state = :initial + elsif match = scan(/\s+/m) + encoder.text_token(match, :space) + else + # Note this clause doesn’t advance the scan pointer, it’s a kind of + # "retry with other options" (the :initial state then of course + # advances the pointer). + state = :initial + end + else + raise + end + + end + + if options[:keep_state] + @state = state + end + + encoder.end_group :string if [:string].include? state + brace_depth.times { encoder.end_group :map } + + encoder + end + + end + +end +end diff --git a/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/php.rb b/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/php.rb new file mode 100644 index 0000000..7a8d75d --- /dev/null +++ b/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/php.rb @@ -0,0 +1,527 @@ +# encoding: utf-8 +module CodeRay +module Scanners + + load :html + + # Scanner for PHP. + # + # Original by Stefan Walk. + class PHP < Scanner + + register_for :php + file_extension 'php' + + KINDS_NOT_LOC = HTML::KINDS_NOT_LOC + + protected + + def setup + @html_scanner = CodeRay.scanner :html, :tokens => @tokens, :keep_tokens => true, :keep_state => true + end + + def reset_instance + super + @html_scanner.reset + end + + module Words # :nodoc: + + # according to http://www.php.net/manual/en/reserved.keywords.php + KEYWORDS = %w[ + abstract and array as break case catch class clone const continue declare default do else elseif + enddeclare endfor endforeach endif endswitch endwhile extends final for foreach function global + goto if implements interface instanceof namespace new or private protected public static switch + throw try use var while xor + cfunction old_function + ] + + TYPES = %w[ int integer float double bool boolean string array object resource ] + + LANGUAGE_CONSTRUCTS = %w[ + die echo empty exit eval include include_once isset list + require require_once return print unset + ] + + CLASSES = %w[ Directory stdClass __PHP_Incomplete_Class exception php_user_filter Closure ] + + # according to http://php.net/quickref.php on 2009-04-21; + # all functions with _ excluded (module functions) and selected additional functions + BUILTIN_FUNCTIONS = %w[ + abs acos acosh addcslashes addslashes aggregate array arsort ascii2ebcdic asin asinh asort assert atan atan2 + atanh basename bcadd bccomp bcdiv bcmod bcmul bcpow bcpowmod bcscale bcsqrt bcsub bin2hex bindec + bindtextdomain bzclose bzcompress bzdecompress bzerrno bzerror bzerrstr bzflush bzopen bzread bzwrite + calculhmac ceil chdir checkdate checkdnsrr chgrp chmod chop chown chr chroot clearstatcache closedir closelog + compact constant copy cos cosh count crc32 crypt current date dcgettext dcngettext deaggregate decbin dechex + decoct define defined deg2rad delete dgettext die dirname diskfreespace dl dngettext doubleval each + ebcdic2ascii echo empty end ereg eregi escapeshellarg escapeshellcmd eval exec exit exp explode expm1 extract + fclose feof fflush fgetc fgetcsv fgets fgetss file fileatime filectime filegroup fileinode filemtime fileowner + fileperms filepro filesize filetype floatval flock floor flush fmod fnmatch fopen fpassthru fprintf fputcsv + fputs fread frenchtojd fscanf fseek fsockopen fstat ftell ftok ftruncate fwrite getallheaders getcwd getdate + getenv gethostbyaddr gethostbyname gethostbynamel getimagesize getlastmod getmxrr getmygid getmyinode getmypid + getmyuid getopt getprotobyname getprotobynumber getrandmax getrusage getservbyname getservbyport gettext + gettimeofday gettype glob gmdate gmmktime gmstrftime gregoriantojd gzclose gzcompress gzdecode gzdeflate + gzencode gzeof gzfile gzgetc gzgets gzgetss gzinflate gzopen gzpassthru gzputs gzread gzrewind gzseek gztell + gzuncompress gzwrite hash header hebrev hebrevc hexdec htmlentities htmlspecialchars hypot iconv idate + implode include intval ip2long iptcembed iptcparse isset + jddayofweek jdmonthname jdtofrench jdtogregorian jdtojewish jdtojulian jdtounix jewishtojd join jpeg2wbmp + juliantojd key krsort ksort lcfirst lchgrp lchown levenshtein link linkinfo list localeconv localtime log + log10 log1p long2ip lstat ltrim mail main max md5 metaphone mhash microtime min mkdir mktime msql natcasesort + natsort next ngettext nl2br nthmac octdec opendir openlog + ord overload pack passthru pathinfo pclose pfsockopen phpcredits phpinfo phpversion pi png2wbmp popen pos pow + prev print printf putenv quotemeta rad2deg rand range rawurldecode rawurlencode readdir readfile readgzfile + readline readlink realpath recode rename require reset rewind rewinddir rmdir round rsort rtrim scandir + serialize setcookie setlocale setrawcookie settype sha1 shuffle signeurlpaiement sin sinh sizeof sleep snmpget + snmpgetnext snmprealwalk snmpset snmpwalk snmpwalkoid sort soundex split spliti sprintf sqrt srand sscanf stat + strcasecmp strchr strcmp strcoll strcspn strftime stripcslashes stripos stripslashes stristr strlen + strnatcasecmp strnatcmp strncasecmp strncmp strpbrk strpos strptime strrchr strrev strripos strrpos strspn + strstr strtok strtolower strtotime strtoupper strtr strval substr symlink syslog system tan tanh tempnam + textdomain time tmpfile touch trim uasort ucfirst ucwords uksort umask uniqid unixtojd unlink unpack + unserialize unset urldecode urlencode usleep usort vfprintf virtual vprintf vsprintf wordwrap + array_change_key_case array_chunk array_combine array_count_values array_diff array_diff_assoc + array_diff_key array_diff_uassoc array_diff_ukey array_fill array_fill_keys array_filter array_flip + array_intersect array_intersect_assoc array_intersect_key array_intersect_uassoc array_intersect_ukey + array_key_exists array_keys array_map array_merge array_merge_recursive array_multisort array_pad + array_pop array_product array_push array_rand array_reduce array_reverse array_search array_shift + array_slice array_splice array_sum array_udiff array_udiff_assoc array_udiff_uassoc array_uintersect + array_uintersect_assoc array_uintersect_uassoc array_unique array_unshift array_values array_walk + array_walk_recursive + assert_options base_convert base64_decode base64_encode + chunk_split class_exists class_implements class_parents + count_chars debug_backtrace debug_print_backtrace debug_zval_dump + error_get_last error_log error_reporting extension_loaded + file_exists file_get_contents file_put_contents load_file + func_get_arg func_get_args func_num_args function_exists + get_browser get_called_class get_cfg_var get_class get_class_methods get_class_vars + get_current_user get_declared_classes get_declared_interfaces get_defined_constants + get_defined_functions get_defined_vars get_extension_funcs get_headers get_html_translation_table + get_include_path get_included_files get_loaded_extensions get_magic_quotes_gpc get_magic_quotes_runtime + get_meta_tags get_object_vars get_parent_class get_required_filesget_resource_type + gc_collect_cycles gc_disable gc_enable gc_enabled + halt_compiler headers_list headers_sent highlight_file highlight_string + html_entity_decode htmlspecialchars_decode + in_array include_once inclued_get_data + is_a is_array is_binary is_bool is_buffer is_callable is_dir is_double is_executable is_file is_finite + is_float is_infinite is_int is_integer is_link is_long is_nan is_null is_numeric is_object is_readable + is_real is_resource is_scalar is_soap_fault is_string is_subclass_of is_unicode is_uploaded_file + is_writable is_writeable + locale_get_default locale_set_default + number_format override_function parse_str parse_url + php_check_syntax php_ini_loaded_file php_ini_scanned_files php_logo_guid php_sapi_name + php_strip_whitespace php_uname + preg_filter preg_grep preg_last_error preg_match preg_match_all preg_quote preg_replace + preg_replace_callback preg_split print_r + require_once register_shutdown_function register_tick_function + set_error_handler set_exception_handler set_file_buffer set_include_path + set_magic_quotes_runtime set_time_limit shell_exec + str_getcsv str_ireplace str_pad str_repeat str_replace str_rot13 str_shuffle str_split str_word_count + strip_tags substr_compare substr_count substr_replace + time_nanosleep time_sleep_until + token_get_all token_name trigger_error + unregister_tick_function use_soap_error_handler user_error + utf8_decode utf8_encode var_dump var_export + version_compare + zend_logo_guid zend_thread_id zend_version + create_function call_user_func_array + posix_access posix_ctermid posix_get_last_error posix_getcwd posix_getegid + posix_geteuid posix_getgid posix_getgrgid posix_getgrnam posix_getgroups + posix_getlogin posix_getpgid posix_getpgrp posix_getpid posix_getppid + posix_getpwnam posix_getpwuid posix_getrlimit posix_getsid posix_getuid + posix_initgroups posix_isatty posix_kill posix_mkfifo posix_mknod + posix_setegid posix_seteuid posix_setgid posix_setpgid posix_setsid + posix_setuid posix_strerror posix_times posix_ttyname posix_uname + pcntl_alarm pcntl_exec pcntl_fork pcntl_getpriority pcntl_setpriority + pcntl_signal pcntl_signal_dispatch pcntl_sigprocmask pcntl_sigtimedwait + pcntl_sigwaitinfo pcntl_wait pcntl_waitpid pcntl_wexitstatus pcntl_wifexited + pcntl_wifsignaled pcntl_wifstopped pcntl_wstopsig pcntl_wtermsig + ] + # TODO: more built-in PHP functions? + + EXCEPTIONS = %w[ + E_ERROR E_WARNING E_PARSE E_NOTICE E_CORE_ERROR E_CORE_WARNING E_COMPILE_ERROR E_COMPILE_WARNING + E_USER_ERROR E_USER_WARNING E_USER_NOTICE E_DEPRECATED E_USER_DEPRECATED E_ALL E_STRICT + ] + + CONSTANTS = %w[ + null true false self parent + __LINE__ __DIR__ __FILE__ __LINE__ + __CLASS__ __NAMESPACE__ __METHOD__ __FUNCTION__ + PHP_VERSION PHP_MAJOR_VERSION PHP_MINOR_VERSION PHP_RELEASE_VERSION PHP_VERSION_ID PHP_EXTRA_VERSION PHP_ZTS + PHP_DEBUG PHP_MAXPATHLEN PHP_OS PHP_SAPI PHP_EOL PHP_INT_MAX PHP_INT_SIZE DEFAULT_INCLUDE_PATH + PEAR_INSTALL_DIR PEAR_EXTENSION_DIR PHP_EXTENSION_DIR PHP_PREFIX PHP_BINDIR PHP_LIBDIR PHP_DATADIR + PHP_SYSCONFDIR PHP_LOCALSTATEDIR PHP_CONFIG_FILE_PATH PHP_CONFIG_FILE_SCAN_DIR PHP_SHLIB_SUFFIX + PHP_OUTPUT_HANDLER_START PHP_OUTPUT_HANDLER_CONT PHP_OUTPUT_HANDLER_END + __COMPILER_HALT_OFFSET__ + EXTR_OVERWRITE EXTR_SKIP EXTR_PREFIX_SAME EXTR_PREFIX_ALL EXTR_PREFIX_INVALID EXTR_PREFIX_IF_EXISTS + EXTR_IF_EXISTS SORT_ASC SORT_DESC SORT_REGULAR SORT_NUMERIC SORT_STRING CASE_LOWER CASE_UPPER COUNT_NORMAL + COUNT_RECURSIVE ASSERT_ACTIVE ASSERT_CALLBACK ASSERT_BAIL ASSERT_WARNING ASSERT_QUIET_EVAL CONNECTION_ABORTED + CONNECTION_NORMAL CONNECTION_TIMEOUT INI_USER INI_PERDIR INI_SYSTEM INI_ALL M_E M_LOG2E M_LOG10E M_LN2 M_LN10 + M_PI M_PI_2 M_PI_4 M_1_PI M_2_PI M_2_SQRTPI M_SQRT2 M_SQRT1_2 CRYPT_SALT_LENGTH CRYPT_STD_DES CRYPT_EXT_DES + CRYPT_MD5 CRYPT_BLOWFISH DIRECTORY_SEPARATOR SEEK_SET SEEK_CUR SEEK_END LOCK_SH LOCK_EX LOCK_UN LOCK_NB + HTML_SPECIALCHARS HTML_ENTITIES ENT_COMPAT ENT_QUOTES ENT_NOQUOTES INFO_GENERAL INFO_CREDITS + INFO_CONFIGURATION INFO_MODULES INFO_ENVIRONMENT INFO_VARIABLES INFO_LICENSE INFO_ALL CREDITS_GROUP + CREDITS_GENERAL CREDITS_SAPI CREDITS_MODULES CREDITS_DOCS CREDITS_FULLPAGE CREDITS_QA CREDITS_ALL STR_PAD_LEFT + STR_PAD_RIGHT STR_PAD_BOTH PATHINFO_DIRNAME PATHINFO_BASENAME PATHINFO_EXTENSION PATH_SEPARATOR CHAR_MAX + LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_ALL LC_MESSAGES ABDAY_1 ABDAY_2 ABDAY_3 ABDAY_4 ABDAY_5 + ABDAY_6 ABDAY_7 DAY_1 DAY_2 DAY_3 DAY_4 DAY_5 DAY_6 DAY_7 ABMON_1 ABMON_2 ABMON_3 ABMON_4 ABMON_5 ABMON_6 + ABMON_7 ABMON_8 ABMON_9 ABMON_10 ABMON_11 ABMON_12 MON_1 MON_2 MON_3 MON_4 MON_5 MON_6 MON_7 MON_8 MON_9 + MON_10 MON_11 MON_12 AM_STR PM_STR D_T_FMT D_FMT T_FMT T_FMT_AMPM ERA ERA_YEAR ERA_D_T_FMT ERA_D_FMT ERA_T_FMT + ALT_DIGITS INT_CURR_SYMBOL CURRENCY_SYMBOL CRNCYSTR MON_DECIMAL_POINT MON_THOUSANDS_SEP MON_GROUPING + POSITIVE_SIGN NEGATIVE_SIGN INT_FRAC_DIGITS FRAC_DIGITS P_CS_PRECEDES P_SEP_BY_SPACE N_CS_PRECEDES + N_SEP_BY_SPACE P_SIGN_POSN N_SIGN_POSN DECIMAL_POINT RADIXCHAR THOUSANDS_SEP THOUSEP GROUPING YESEXPR NOEXPR + YESSTR NOSTR CODESET LOG_EMERG LOG_ALERT LOG_CRIT LOG_ERR LOG_WARNING LOG_NOTICE LOG_INFO LOG_DEBUG LOG_KERN + LOG_USER LOG_MAIL LOG_DAEMON LOG_AUTH LOG_SYSLOG LOG_LPR LOG_NEWS LOG_UUCP LOG_CRON LOG_AUTHPRIV LOG_LOCAL0 + LOG_LOCAL1 LOG_LOCAL2 LOG_LOCAL3 LOG_LOCAL4 LOG_LOCAL5 LOG_LOCAL6 LOG_LOCAL7 LOG_PID LOG_CONS LOG_ODELAY + LOG_NDELAY LOG_NOWAIT LOG_PERROR + ] + + PREDEFINED = %w[ + $GLOBALS $_SERVER $_GET $_POST $_FILES $_REQUEST $_SESSION $_ENV + $_COOKIE $php_errormsg $HTTP_RAW_POST_DATA $http_response_header + $argc $argv + ] + + IDENT_KIND = WordList::CaseIgnoring.new(:ident). + add(KEYWORDS, :keyword). + add(TYPES, :predefined_type). + add(LANGUAGE_CONSTRUCTS, :keyword). + add(BUILTIN_FUNCTIONS, :predefined). + add(CLASSES, :predefined_constant). + add(EXCEPTIONS, :exception). + add(CONSTANTS, :predefined_constant) + + VARIABLE_KIND = WordList.new(:local_variable). + add(PREDEFINED, :predefined) + end + + module RE # :nodoc: + + PHP_START = / + | + \?> + !xi + + HTML_INDICATOR = / ]/i + + IDENTIFIER = 'ä'[/[[:alpha:]]/] == 'ä' ? Regexp.new('[[:alpha:]_[^\0-\177]][[:alnum:]_[^\0-\177]]*') : Regexp.new('[a-z_\x7f-\xFF][a-z0-9_\x7f-\xFF]*', true) + VARIABLE = /\$#{IDENTIFIER}/ + + OPERATOR = / + \.(?!\d)=? | # dot that is not decimal point, string concatenation + && | \|\| | # logic + :: | -> | => | # scope, member, dictionary + \\(?!\n) | # namespace + \+\+ | -- | # increment, decrement + [,;?:()\[\]{}] | # simple delimiters + [-+*\/%&|^]=? | # ordinary math, binary logic, assignment shortcuts + [~$] | # whatever + =& | # reference assignment + [=!]=?=? | <> | # comparison and assignment + <<=? | >>=? | [<>]=? # comparison and shift + /x + + end + + protected + + def scan_tokens encoder, options + + if check(RE::PHP_START) || # starts with + (match?(/\s*<\S/) && check(/.{1,1000}#{RE::PHP_START}/om)) || # starts with tag and contains + check(/.{0,1000}#{RE::HTML_INDICATOR}/om) || + check(/.{1,100}#{RE::PHP_START}/om) # PHP start after max 100 chars + # is HTML with embedded PHP, so start with HTML + states = [:initial] + else + # is just PHP, so start with PHP surrounded by HTML + states = [:initial, :php] + end + + label_expected = true + case_expected = false + + heredoc_delimiter = nil + delimiter = nil + modifier = nil + + until eos? + + case states.last + + when :initial # HTML + if match = scan(RE::PHP_START) + encoder.text_token match, :inline_delimiter + label_expected = true + states << :php + else + match = scan_until(/(?=#{RE::PHP_START})/o) || scan_rest + @html_scanner.tokenize match unless match.empty? + end + + when :php, :php_inline + if match = scan(/\s+/) + encoder.text_token match, :space + + elsif match = scan(%r! (?m: \/\* (?: .*? \*\/ | .* ) ) | (?://|\#) .*? (?=#{RE::PHP_END}|$) !xo) + encoder.text_token match, :comment + + elsif match = scan(RE::IDENTIFIER) + kind = Words::IDENT_KIND[match] + if kind == :ident && label_expected && check(/:(?!:)/) + kind = :label + label_expected = true + else + label_expected = false + if kind == :ident && match =~ /^[A-Z]/ + kind = :constant + elsif kind == :keyword + case match + when 'class' + states << :class_expected + when 'function' + states << :function_expected + when 'case', 'default' + case_expected = true + end + elsif match == 'b' && check(/['"]/) # binary string literal + modifier = match + next + end + end + encoder.text_token match, kind + + elsif match = scan(/(?:\d+\.\d*|\d*\.\d+)(?:e[-+]?\d+)?|\d+e[-+]?\d+/i) + label_expected = false + encoder.text_token match, :float + + elsif match = scan(/0x[0-9a-fA-F]+/) + label_expected = false + encoder.text_token match, :hex + + elsif match = scan(/\d+/) + label_expected = false + encoder.text_token match, :integer + + elsif match = scan(/['"`]/) + encoder.begin_group :string + if modifier + encoder.text_token modifier, :modifier + modifier = nil + end + delimiter = match + encoder.text_token match, :delimiter + states.push match == "'" ? :sqstring : :dqstring + + elsif match = scan(RE::VARIABLE) + label_expected = false + encoder.text_token match, Words::VARIABLE_KIND[match] + + elsif match = scan(/\{/) + encoder.text_token match, :operator + label_expected = true + states.push :php + + elsif match = scan(/\}/) + if states.size == 1 + encoder.text_token match, :error + else + state = states.pop + if states.last.is_a?(::Array) + delimiter = states.last[1] + states[-1] = states.last[0] + encoder.text_token match, :delimiter + encoder.end_group :inline + else + encoder.text_token match, :operator + encoder.end_group :inline if state == :php_inline + label_expected = true + end + end + + elsif match = scan(/@/) + label_expected = false + encoder.text_token match, :exception + + elsif match = scan(RE::PHP_END) + encoder.text_token match, :inline_delimiter + while state = states.pop + encoder.end_group :string if [:sqstring, :dqstring].include? state + if state.is_a? Array + encoder.end_group :inline + encoder.end_group :string if [:sqstring, :dqstring].include? state.first + end + end + states << :initial + + elsif match = scan(/<<<(?:(#{RE::IDENTIFIER})|"(#{RE::IDENTIFIER})"|'(#{RE::IDENTIFIER})')/o) + encoder.begin_group :string + # warn 'heredoc in heredoc?' if heredoc_delimiter + heredoc_delimiter = Regexp.escape(self[1] || self[2] || self[3]) + encoder.text_token match, :delimiter + states.push self[3] ? :sqstring : :dqstring + heredoc_delimiter = /#{heredoc_delimiter}(?=;?$)/ + + elsif match = scan(/#{RE::OPERATOR}/o) + label_expected = match == ';' + if case_expected + label_expected = true if match == ':' + case_expected = false + end + encoder.text_token match, :operator + + else + encoder.text_token getch, :error + + end + + when :sqstring + if match = scan(heredoc_delimiter ? /[^\\\n]+/ : /[^'\\]+/) + encoder.text_token match, :content + elsif !heredoc_delimiter && match = scan(/'/) + encoder.text_token match, :delimiter + encoder.end_group :string + delimiter = nil + label_expected = false + states.pop + elsif heredoc_delimiter && match = scan(/\n/) + if scan heredoc_delimiter + encoder.text_token "\n", :content + encoder.text_token matched, :delimiter + encoder.end_group :string + heredoc_delimiter = nil + label_expected = false + states.pop + else + encoder.text_token match, :content + end + elsif match = scan(heredoc_delimiter ? /\\\\/ : /\\[\\'\n]/) + encoder.text_token match, :char + elsif match = scan(/\\./m) + encoder.text_token match, :content + elsif match = scan(/\\/) + encoder.text_token match, :error + else + encoder.end_group :string + states.pop + end + + when :dqstring + if match = scan(heredoc_delimiter ? /[^${\\\n]+/ : (delimiter == '"' ? /[^"${\\]+/ : /[^`${\\]+/)) + encoder.text_token match, :content + elsif !heredoc_delimiter && match = scan(delimiter == '"' ? /"/ : /`/) + encoder.text_token match, :delimiter + encoder.end_group :string + delimiter = nil + label_expected = false + states.pop + elsif heredoc_delimiter && match = scan(/\n/) + if scan heredoc_delimiter + encoder.text_token "\n", :content + encoder.text_token matched, :delimiter + encoder.end_group :string + heredoc_delimiter = nil + label_expected = false + states.pop + else + encoder.text_token match, :content + end + elsif match = scan(/\\(?:x[0-9A-Fa-f]{1,2}|[0-7]{1,3})/) + encoder.text_token match, :char + elsif match = scan(heredoc_delimiter ? /\\[nrtvf\\$]/ : (delimiter == '"' ? /\\[nrtvf\\$"]/ : /\\[nrtvf\\$`]/)) + encoder.text_token match, :char + elsif match = scan(/\\./m) + encoder.text_token match, :content + elsif match = scan(/\\/) + encoder.text_token match, :error + elsif match = scan(/#{RE::VARIABLE}/o) + if check(/\[#{RE::IDENTIFIER}\]/o) + encoder.begin_group :inline + encoder.text_token match, :local_variable + encoder.text_token scan(/\[/), :operator + encoder.text_token scan(/#{RE::IDENTIFIER}/o), :ident + encoder.text_token scan(/\]/), :operator + encoder.end_group :inline + elsif check(/\[/) + match << scan(/\[['"]?#{RE::IDENTIFIER}?['"]?\]?/o) + encoder.text_token match, :error + elsif check(/->#{RE::IDENTIFIER}/o) + encoder.begin_group :inline + encoder.text_token match, :local_variable + encoder.text_token scan(/->/), :operator + encoder.text_token scan(/#{RE::IDENTIFIER}/o), :ident + encoder.end_group :inline + elsif check(/->/) + match << scan(/->/) + encoder.text_token match, :error + else + encoder.text_token match, :local_variable + end + elsif match = scan(/\{/) + if check(/\$/) + encoder.begin_group :inline + states[-1] = [states.last, delimiter] + delimiter = nil + states.push :php_inline + encoder.text_token match, :delimiter + else + encoder.text_token match, :content + end + elsif match = scan(/\$\{#{RE::IDENTIFIER}\}/o) + encoder.text_token match, :local_variable + elsif match = scan(/\$/) + encoder.text_token match, :content + else + encoder.end_group :string + states.pop + end + + when :class_expected + if match = scan(/\s+/) + encoder.text_token match, :space + elsif match = scan(/#{RE::IDENTIFIER}/o) + encoder.text_token match, :class + states.pop + else + states.pop + end + + when :function_expected + if match = scan(/\s+/) + encoder.text_token match, :space + elsif match = scan(/&/) + encoder.text_token match, :operator + elsif match = scan(/#{RE::IDENTIFIER}/o) + encoder.text_token match, :function + states.pop + else + states.pop + end + + else + raise_inspect 'Unknown state!', encoder, states + end + + end + + while state = states.pop + encoder.end_group :string if [:sqstring, :dqstring].include? state + if state.is_a? Array + encoder.end_group :inline + encoder.end_group :string if [:sqstring, :dqstring].include? state.first + end + end + + encoder + end + + end + +end +end diff --git a/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/python.rb b/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/python.rb new file mode 100644 index 0000000..09c8b6e --- /dev/null +++ b/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/python.rb @@ -0,0 +1,287 @@ +module CodeRay +module Scanners + + # Scanner for Python. Supports Python 3. + # + # Based on pygments' PythonLexer, see + # http://dev.pocoo.org/projects/pygments/browser/pygments/lexers/agile.py. + class Python < Scanner + + register_for :python + file_extension 'py' + + KEYWORDS = [ + 'and', 'as', 'assert', 'break', 'class', 'continue', 'def', + 'del', 'elif', 'else', 'except', 'finally', 'for', + 'from', 'global', 'if', 'import', 'in', 'is', 'lambda', 'not', + 'or', 'pass', 'raise', 'return', 'try', 'while', 'with', 'yield', + 'nonlocal', # new in Python 3 + ] # :nodoc: + + OLD_KEYWORDS = [ + 'exec', 'print', # gone in Python 3 + ] # :nodoc: + + PREDEFINED_METHODS_AND_TYPES = %w[ + __import__ abs all any apply basestring bin bool buffer + bytearray bytes callable chr classmethod cmp coerce compile + complex delattr dict dir divmod enumerate eval execfile exit + file filter float frozenset getattr globals hasattr hash hex id + input int intern isinstance issubclass iter len list locals + long map max min next object oct open ord pow property range + raw_input reduce reload repr reversed round set setattr slice + sorted staticmethod str sum super tuple type unichr unicode + vars xrange zip + ] # :nodoc: + + PREDEFINED_EXCEPTIONS = %w[ + ArithmeticError AssertionError AttributeError + BaseException DeprecationWarning EOFError EnvironmentError + Exception FloatingPointError FutureWarning GeneratorExit IOError + ImportError ImportWarning IndentationError IndexError KeyError + KeyboardInterrupt LookupError MemoryError NameError + NotImplemented NotImplementedError OSError OverflowError + OverflowWarning PendingDeprecationWarning ReferenceError + RuntimeError RuntimeWarning StandardError StopIteration + SyntaxError SyntaxWarning SystemError SystemExit TabError + TypeError UnboundLocalError UnicodeDecodeError + UnicodeEncodeError UnicodeError UnicodeTranslateError + UnicodeWarning UserWarning ValueError Warning ZeroDivisionError + ] # :nodoc: + + PREDEFINED_VARIABLES_AND_CONSTANTS = [ + 'False', 'True', 'None', # "keywords" since Python 3 + 'self', 'Ellipsis', 'NotImplemented', + ] # :nodoc: + + IDENT_KIND = WordList.new(:ident). + add(KEYWORDS, :keyword). + add(OLD_KEYWORDS, :old_keyword). + add(PREDEFINED_METHODS_AND_TYPES, :predefined). + add(PREDEFINED_VARIABLES_AND_CONSTANTS, :predefined_constant). + add(PREDEFINED_EXCEPTIONS, :exception) # :nodoc: + + NAME = / [[:alpha:]_] \w* /x # :nodoc: + ESCAPE = / [abfnrtv\n\\'"] | x[a-fA-F0-9]{1,2} | [0-7]{1,3} /x # :nodoc: + UNICODE_ESCAPE = / u[a-fA-F0-9]{4} | U[a-fA-F0-9]{8} | N\{[-\w ]+\} /x # :nodoc: + + OPERATOR = / + \.\.\. | # ellipsis + \.(?!\d) | # dot but not decimal point + [,;:()\[\]{}] | # simple delimiters + \/\/=? | \*\*=? | # special math + [-+*\/%&|^]=? | # ordinary math and binary logic + [~`] | # binary complement and inspection + <<=? | >>=? | [<>=]=? | != # comparison and assignment + /x # :nodoc: + + STRING_DELIMITER_REGEXP = Hash.new { |h, delimiter| + h[delimiter] = Regexp.union delimiter # :nodoc: + } + + STRING_CONTENT_REGEXP = Hash.new { |h, delimiter| + h[delimiter] = / [^\\\n]+? (?= \\ | $ | #{Regexp.escape(delimiter)} ) /x # :nodoc: + } + + DEF_NEW_STATE = WordList.new(:initial). + add(%w(def), :def_expected). + add(%w(import from), :include_expected). + add(%w(class), :class_expected) # :nodoc: + + DESCRIPTOR = / + #{NAME} + (?: \. #{NAME} )* + | \* + /x # :nodoc: + + DOCSTRING_COMING = / + [ \t]* u?r? ("""|''') + /x # :nodoc: + + protected + + def scan_tokens encoder, options + + state = :initial + string_delimiter = nil + string_raw = false + string_type = nil + docstring_coming = match?(/#{DOCSTRING_COMING}/o) + last_token_dot = false + unicode = string.respond_to?(:encoding) && string.encoding.name == 'UTF-8' + from_import_state = [] + + until eos? + + if state == :string + if match = scan(STRING_DELIMITER_REGEXP[string_delimiter]) + encoder.text_token match, :delimiter + encoder.end_group string_type + string_type = nil + state = :initial + next + elsif string_delimiter.size == 3 && match = scan(/\n/) + encoder.text_token match, :content + elsif match = scan(STRING_CONTENT_REGEXP[string_delimiter]) + encoder.text_token match, :content + elsif !string_raw && match = scan(/ \\ #{ESCAPE} /ox) + encoder.text_token match, :char + elsif match = scan(/ \\ #{UNICODE_ESCAPE} /ox) + encoder.text_token match, :char + elsif match = scan(/ \\ . /x) + encoder.text_token match, :content + elsif match = scan(/ \\ | $ /x) + encoder.end_group string_type + string_type = nil + encoder.text_token match, :error unless match.empty? + state = :initial + else + raise_inspect "else case \" reached; %p not handled." % peek(1), encoder, state + end + + elsif match = scan(/ [ \t]+ | \\?\n /x) + encoder.text_token match, :space + if match == "\n" + state = :initial if state == :include_expected + docstring_coming = true if match?(/#{DOCSTRING_COMING}/o) + end + next + + elsif match = scan(/ \# [^\n]* /mx) + encoder.text_token match, :comment + next + + elsif state == :initial + + if match = scan(/#{OPERATOR}/o) + encoder.text_token match, :operator + + elsif match = scan(/(u?r?|b)?("""|"|'''|')/i) + modifiers = self[1] + string_delimiter = self[2] + string_type = docstring_coming ? :docstring : (modifiers == 'b' ? :binary : :string) + docstring_coming = false if docstring_coming + encoder.begin_group string_type + string_raw = false + unless modifiers.empty? + string_raw = !!modifiers.index(?r) + encoder.text_token modifiers, :modifier + match = string_delimiter + end + state = :string + encoder.text_token match, :delimiter + + # TODO: backticks + + elsif match = scan(unicode ? /#{NAME}/uo : /#{NAME}/o) + kind = IDENT_KIND[match] + # TODO: keyword arguments + kind = :ident if last_token_dot + if kind == :old_keyword + kind = check(/\(/) ? :ident : :keyword + elsif kind == :predefined && check(/ *=/) + kind = :ident + elsif kind == :keyword + state = DEF_NEW_STATE[match] + from_import_state << match.to_sym if state == :include_expected + end + encoder.text_token match, kind + + elsif match = scan(/@[a-zA-Z0-9_.]+[lL]?/) + encoder.text_token match, :decorator + + elsif match = scan(/0[xX][0-9A-Fa-f]+[lL]?/) + encoder.text_token match, :hex + + elsif match = scan(/0[bB][01]+[lL]?/) + encoder.text_token match, :binary + + elsif match = scan(/(?:\d*\.\d+|\d+\.\d*)(?:[eE][+-]?\d+)?|\d+[eE][+-]?\d+/) + if scan(/[jJ]/) + match << matched + encoder.text_token match, :imaginary + else + encoder.text_token match, :float + end + + elsif match = scan(/0[oO][0-7]+|0[0-7]+(?![89.eE])[lL]?/) + encoder.text_token match, :octal + + elsif match = scan(/\d+([lL])?/) + if self[1] == nil && scan(/[jJ]/) + match << matched + encoder.text_token match, :imaginary + else + encoder.text_token match, :integer + end + + else + encoder.text_token getch, :error + + end + + elsif state == :def_expected + state = :initial + if match = scan(unicode ? /#{NAME}/uo : /#{NAME}/o) + encoder.text_token match, :method + else + next + end + + elsif state == :class_expected + state = :initial + if match = scan(unicode ? /#{NAME}/uo : /#{NAME}/o) + encoder.text_token match, :class + else + next + end + + elsif state == :include_expected + if match = scan(unicode ? /#{DESCRIPTOR}/uo : /#{DESCRIPTOR}/o) + if match == 'as' + encoder.text_token match, :keyword + from_import_state << :as + elsif from_import_state.first == :from && match == 'import' + encoder.text_token match, :keyword + from_import_state << :import + elsif from_import_state.last == :as + # encoder.text_token match, match[0,1][unicode ? /[[:upper:]]/u : /[[:upper:]]/] ? :class : :method + encoder.text_token match, :ident + from_import_state.pop + elsif IDENT_KIND[match] == :keyword + unscan + match = nil + state = :initial + next + else + encoder.text_token match, :include + end + elsif match = scan(/,/) + from_import_state.pop if from_import_state.last == :as + encoder.text_token match, :operator + else + from_import_state = [] + state = :initial + next + end + + else + raise_inspect 'Unknown state', encoder, state + + end + + last_token_dot = match == '.' + + end + + if state == :string + encoder.end_group string_type + end + + encoder + end + + end + +end +end diff --git a/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/raydebug.rb b/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/raydebug.rb new file mode 100644 index 0000000..1effdc8 --- /dev/null +++ b/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/raydebug.rb @@ -0,0 +1,75 @@ +require 'set' + +module CodeRay +module Scanners + + # = Raydebug Scanner + # + # Highlights the output of the Encoders::Debug encoder. + class Raydebug < Scanner + + register_for :raydebug + file_extension 'raydebug' + title 'CodeRay Token Dump' + + protected + + def setup + super + @known_token_kinds = TokenKinds.keys.map(&:to_s).to_set + end + + def scan_tokens encoder, options + + opened_tokens = [] + + until eos? + + if match = scan(/\s+/) + encoder.text_token match, :space + + elsif match = scan(/ (\w+) \( ( [^\)\\]* ( \\. [^\)\\]* )* ) /x) + kind = self[1] + encoder.text_token kind, :class + encoder.text_token '(', :operator + match = self[2] + unless match.empty? + if @known_token_kinds.include? kind + encoder.text_token match, kind.to_sym + else + encoder.text_token match, :plain + end + end + encoder.text_token match, :operator if match = scan(/\)/) + + elsif match = scan(/ (\w+) ([<\[]) /x) + encoder.text_token self[1], :class + if @known_token_kinds.include? self[1] + kind = self[1].to_sym + else + kind = :unknown + end + opened_tokens << kind + encoder.begin_group kind + encoder.text_token self[2], :operator + + elsif !opened_tokens.empty? && match = scan(/ [>\]] /x) + encoder.text_token match, :operator + encoder.end_group opened_tokens.pop + + else + encoder.text_token getch, :space + + end + + end + + encoder.end_group opened_tokens.pop until opened_tokens.empty? + + encoder + end + + end + +end +end diff --git a/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/ruby.rb b/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/ruby.rb new file mode 100644 index 0000000..80165ca --- /dev/null +++ b/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/ruby.rb @@ -0,0 +1,470 @@ +module CodeRay +module Scanners + + # This scanner is really complex, since Ruby _is_ a complex language! + # + # It tries to highlight 100% of all common code, + # and 90% of strange codes. + # + # It is optimized for HTML highlighting, and is not very useful for + # parsing or pretty printing. + class Ruby < Scanner + + register_for :ruby + file_extension 'rb' + + autoload :Patterns, CodeRay.coderay_path('scanners', 'ruby', 'patterns') + autoload :StringState, CodeRay.coderay_path('scanners', 'ruby', 'string_state') + + def interpreted_string_state + StringState.new :string, true, '"' + end + + protected + + def setup + @state = :initial + end + + def scan_tokens encoder, options + state, heredocs = options[:state] || @state + heredocs = heredocs.dup if heredocs.is_a?(Array) + + if state && state.instance_of?(StringState) + encoder.begin_group state.type + end + + last_state = nil + + method_call_expected = false + value_expected = true + + inline_block_stack = nil + inline_block_curly_depth = 0 + + if heredocs + state = heredocs.shift + encoder.begin_group state.type + heredocs = nil if heredocs.empty? + end + + # def_object_stack = nil + # def_object_paren_depth = 0 + + patterns = Patterns # avoid constant lookup + + unicode = string.respond_to?(:encoding) && string.encoding.name == 'UTF-8' + + until eos? + + if state.instance_of? ::Symbol + + if match = scan(/[ \t\f\v]+/) + encoder.text_token match, :space + + elsif match = scan(/\n/) + if heredocs + unscan # heredoc scanning needs \n at start + state = heredocs.shift + encoder.begin_group state.type + heredocs = nil if heredocs.empty? + else + state = :initial if state == :undef_comma_expected + encoder.text_token match, :space + value_expected = true + end + + elsif match = scan(bol? ? / \#(!)?.* | #{patterns::RUBYDOC_OR_DATA} /ox : /\#.*/) + encoder.text_token match, self[1] ? :doctype : :comment + + elsif match = scan(/\\\n/) + if heredocs + unscan # heredoc scanning needs \n at start + encoder.text_token scan(/\\/), :space + state = heredocs.shift + encoder.begin_group state.type + heredocs = nil if heredocs.empty? + else + encoder.text_token match, :space + end + + elsif state == :initial + + # IDENTS # + if !method_call_expected && + match = scan(unicode ? /#{patterns::METHOD_NAME}/uo : + /#{patterns::METHOD_NAME}/o) + + kind = patterns::IDENT_KIND[match] + if value_expected != :colon_expected && scan(/:(?!:)/) + value_expected = true + encoder.text_token match, :key + encoder.text_token ':', :operator + else + value_expected = false + if kind == :ident + if match[/\A[A-Z]/] && !(match[/[!?]$/] || match?(/\(/)) + kind = :constant + end + elsif kind == :keyword + state = patterns::KEYWORD_NEW_STATE[match] + if patterns::KEYWORDS_EXPECTING_VALUE[match] + value_expected = match == 'when' ? :colon_expected : true + end + end + value_expected = true if !value_expected && check(/#{patterns::VALUE_FOLLOWS}/o) + encoder.text_token match, kind + end + + elsif method_call_expected && + match = scan(unicode ? /#{patterns::METHOD_AFTER_DOT}/uo : + /#{patterns::METHOD_AFTER_DOT}/o) + if method_call_expected == '::' && match[/\A[A-Z]/] && !match?(/\(/) + encoder.text_token match, :constant + else + encoder.text_token match, :ident + end + method_call_expected = false + value_expected = check(/#{patterns::VALUE_FOLLOWS}/o) + + # OPERATORS # + elsif !method_call_expected && match = scan(/ (\.(?!\.)|::) | ( \.\.\.? | ==?=? | [,\(\[\{] ) | [\)\]\}] /x) + method_call_expected = self[1] + value_expected = !method_call_expected && !!self[2] + if inline_block_stack + case match + when '{' + inline_block_curly_depth += 1 + when '}' + inline_block_curly_depth -= 1 + if inline_block_curly_depth == 0 # closing brace of inline block reached + state, inline_block_curly_depth, heredocs = inline_block_stack.pop + inline_block_stack = nil if inline_block_stack.empty? + heredocs = nil if heredocs && heredocs.empty? + encoder.text_token match, :inline_delimiter + encoder.end_group :inline + next + end + end + end + encoder.text_token match, :operator + + elsif match = scan(unicode ? /#{patterns::SYMBOL}/uo : + /#{patterns::SYMBOL}/o) + case delim = match[1] + when ?', ?" + encoder.begin_group :symbol + encoder.text_token ':', :symbol + match = delim.chr + encoder.text_token match, :delimiter + state = self.class::StringState.new :symbol, delim == ?", match + else + encoder.text_token match, :symbol + value_expected = false + end + + elsif match = scan(/ ' (?:(?>[^'\\]*) ')? | " (?:(?>[^"\\\#]*) ")? /mx) + encoder.begin_group :string + if match.size == 1 + encoder.text_token match, :delimiter + state = self.class::StringState.new :string, match == '"', match # important for streaming + else + encoder.text_token match[0,1], :delimiter + encoder.text_token match[1..-2], :content if match.size > 2 + encoder.text_token match[-1,1], :delimiter + encoder.end_group :string + value_expected = false + end + + elsif match = scan(unicode ? /#{patterns::INSTANCE_VARIABLE}/uo : + /#{patterns::INSTANCE_VARIABLE}/o) + value_expected = false + encoder.text_token match, :instance_variable + + elsif value_expected && match = scan(/\//) + encoder.begin_group :regexp + encoder.text_token match, :delimiter + state = self.class::StringState.new :regexp, true, '/' + + elsif match = scan(value_expected ? /[-+]?#{patterns::NUMERIC}/o : /#{patterns::NUMERIC}/o) + if method_call_expected + encoder.text_token match, :error + method_call_expected = false + else + encoder.text_token match, self[1] ? :float : :integer # TODO: send :hex/:octal/:binary + end + value_expected = false + + elsif match = scan(/ [-+!~^\/]=? | [:;] | [*|&]{1,2}=? | >>? /x) + value_expected = true + encoder.text_token match, :operator + + elsif value_expected && match = scan(/#{patterns::HEREDOC_OPEN}/o) + quote = self[3] + delim = self[quote ? 4 : 2] + kind = patterns::QUOTE_TO_TYPE[quote] + encoder.begin_group kind + encoder.text_token match, :delimiter + encoder.end_group kind + heredocs ||= [] # create heredocs if empty + heredocs << self.class::StringState.new(kind, quote != "'", delim, + self[1] == '-' ? :indented : :linestart) + value_expected = false + + elsif value_expected && match = scan(/#{patterns::FANCY_STRING_START}/o) + kind = patterns::FANCY_STRING_KIND[self[1]] + encoder.begin_group kind + state = self.class::StringState.new kind, patterns::FANCY_STRING_INTERPRETED[self[1]], self[2] + encoder.text_token match, :delimiter + + elsif value_expected && match = scan(/#{patterns::CHARACTER}/o) + value_expected = false + encoder.text_token match, :integer + + elsif match = scan(/ %=? | <(?:<|=>?)? | \? /x) + value_expected = match == '?' ? :colon_expected : true + encoder.text_token match, :operator + + elsif match = scan(/`/) + encoder.begin_group :shell + encoder.text_token match, :delimiter + state = self.class::StringState.new :shell, true, match + + elsif match = scan(unicode ? /#{patterns::GLOBAL_VARIABLE}/uo : + /#{patterns::GLOBAL_VARIABLE}/o) + encoder.text_token match, :global_variable + value_expected = false + + elsif match = scan(unicode ? /#{patterns::CLASS_VARIABLE}/uo : + /#{patterns::CLASS_VARIABLE}/o) + encoder.text_token match, :class_variable + value_expected = false + + elsif match = scan(/\\\z/) + encoder.text_token match, :space + + else + if method_call_expected + method_call_expected = false + next + end + unless unicode + # check for unicode + $DEBUG_BEFORE, $DEBUG = $DEBUG, false + begin + if check(/./mu).size > 1 + # seems like we should try again with unicode + unicode = true + end + rescue + # bad unicode char; use getch + ensure + $DEBUG = $DEBUG_BEFORE + end + next if unicode + end + + encoder.text_token getch, :error + + end + + if last_state + state = last_state unless state.is_a?(StringState) # otherwise, a simple 'def"' results in unclosed tokens + last_state = nil + end + + elsif state == :def_expected + if match = scan(unicode ? /(?>#{patterns::METHOD_NAME_EX})(?!\.|::)/uo : + /(?>#{patterns::METHOD_NAME_EX})(?!\.|::)/o) + encoder.text_token match, :method + state = :initial + else + last_state = :dot_expected + state = :initial + end + + elsif state == :dot_expected + if match = scan(/\.|::/) + # invalid definition + state = :def_expected + encoder.text_token match, :operator + else + state = :initial + end + + elsif state == :module_expected + if match = scan(/<) + encoder.text_token match, :operator + else + state = :initial + if match = scan(unicode ? / (?:#{patterns::IDENT}::)* #{patterns::IDENT} /oux : + / (?:#{patterns::IDENT}::)* #{patterns::IDENT} /ox) + encoder.text_token match, :class + end + end + + elsif state == :undef_expected + state = :undef_comma_expected + if match = scan(unicode ? /(?>#{patterns::METHOD_NAME_EX})(?!\.|::)/uo : + /(?>#{patterns::METHOD_NAME_EX})(?!\.|::)/o) + encoder.text_token match, :method + elsif match = scan(/#{patterns::SYMBOL}/o) + case delim = match[1] + when ?', ?" + encoder.begin_group :symbol + encoder.text_token ':', :symbol + match = delim.chr + encoder.text_token match, :delimiter + state = self.class::StringState.new :symbol, delim == ?", match + state.next_state = :undef_comma_expected + else + encoder.text_token match, :symbol + end + else + state = :initial + end + + elsif state == :undef_comma_expected + if match = scan(/,/) + encoder.text_token match, :operator + state = :undef_expected + else + state = :initial + end + + elsif state == :alias_expected + match = scan(unicode ? /(#{patterns::METHOD_NAME_OR_SYMBOL})([ \t]+)(#{patterns::METHOD_NAME_OR_SYMBOL})/uo : + /(#{patterns::METHOD_NAME_OR_SYMBOL})([ \t]+)(#{patterns::METHOD_NAME_OR_SYMBOL})/o) + + if match + encoder.text_token self[1], (self[1][0] == ?: ? :symbol : :method) + encoder.text_token self[2], :space + encoder.text_token self[3], (self[3][0] == ?: ? :symbol : :method) + end + state = :initial + + else + #:nocov: + raise_inspect 'Unknown state: %p' % [state], encoder + #:nocov: + end + + else # StringState + + match = scan_until(state.pattern) || scan_rest + unless match.empty? + encoder.text_token match, :content + break if eos? + end + + if state.heredoc && self[1] # end of heredoc + match = getch + match << scan_until(/$/) unless eos? + encoder.text_token match, :delimiter unless match.empty? + encoder.end_group state.type + state = state.next_state + next + end + + case match = getch + + when state.delim + if state.paren_depth + state.paren_depth -= 1 + if state.paren_depth > 0 + encoder.text_token match, :content + next + end + end + encoder.text_token match, :delimiter + if state.type == :regexp && !eos? + match = scan(/#{patterns::REGEXP_MODIFIERS}/o) + encoder.text_token match, :modifier unless match.empty? + end + encoder.end_group state.type + value_expected = false + state = state.next_state + + when '\\' + if state.interpreted + if esc = scan(/#{patterns::ESCAPE}/o) + encoder.text_token match + esc, :char + else + encoder.text_token match, :error + end + else + case esc = getch + when nil + encoder.text_token match, :content + when state.delim, '\\' + encoder.text_token match + esc, :char + else + encoder.text_token match + esc, :content + end + end + + when '#' + case peek(1) + when '{' + inline_block_stack ||= [] + inline_block_stack << [state, inline_block_curly_depth, heredocs] + value_expected = true + state = :initial + inline_block_curly_depth = 1 + encoder.begin_group :inline + encoder.text_token match + getch, :inline_delimiter + when '$', '@' + encoder.text_token match, :escape + last_state = state + state = :initial + else + #:nocov: + raise_inspect 'else-case # reached; #%p not handled' % [peek(1)], encoder + #:nocov: + end + + when state.opening_paren + state.paren_depth += 1 + encoder.text_token match, :content + + else + #:nocov + raise_inspect 'else-case " reached; %p not handled, state = %p' % [match, state], encoder + #:nocov: + + end + + end + + end + + # cleaning up + if state.is_a? StringState + encoder.end_group state.type + end + + if options[:keep_state] + if state.is_a?(StringState) && state.heredoc + (heredocs ||= []).unshift state + state = :initial + elsif heredocs && heredocs.empty? + heredocs = nil + end + @state = state, heredocs + end + + if inline_block_stack + until inline_block_stack.empty? + state, = *inline_block_stack.pop + encoder.end_group :inline + encoder.end_group state.type + end + end + + encoder + end + + end + +end +end diff --git a/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/ruby/patterns.rb b/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/ruby/patterns.rb new file mode 100644 index 0000000..0b36e13 --- /dev/null +++ b/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/ruby/patterns.rb @@ -0,0 +1,178 @@ +# encoding: utf-8 +module CodeRay +module Scanners + + module Ruby::Patterns # :nodoc: all + + KEYWORDS = %w[ + and def end in or unless begin + defined? ensure module redo super until + BEGIN break do next rescue then + when END case else for retry + while alias class elsif if not return + undef yield + ] + + # See http://murfy.de/ruby-constants. + PREDEFINED_CONSTANTS = %w[ + nil true false self + DATA ARGV ARGF ENV + FALSE TRUE NIL + STDERR STDIN STDOUT + TOPLEVEL_BINDING + RUBY_COPYRIGHT RUBY_DESCRIPTION RUBY_ENGINE RUBY_PATCHLEVEL + RUBY_PLATFORM RUBY_RELEASE_DATE RUBY_REVISION RUBY_VERSION + __FILE__ __LINE__ __ENCODING__ + ] + + IDENT_KIND = WordList.new(:ident). + add(KEYWORDS, :keyword). + add(PREDEFINED_CONSTANTS, :predefined_constant) + + KEYWORD_NEW_STATE = WordList.new(:initial). + add(%w[ def ], :def_expected). + add(%w[ undef ], :undef_expected). + add(%w[ alias ], :alias_expected). + add(%w[ class module ], :module_expected) + + IDENT = 'ä'[/[[:alpha:]]/] == 'ä' ? Regexp.new('[[:alpha:]_[^\0-\177]][[:alnum:]_[^\0-\177]]*') : /[^\W\d]\w*/ + + METHOD_NAME = / #{IDENT} [?!]? /ox + METHOD_NAME_OPERATOR = / + \*\*? # multiplication and power + | [-+~]@? # plus, minus, tilde with and without at sign + | [\/%&|^`] # division, modulo or format strings, and, or, xor, system + | \[\]=? # array getter and setter + | << | >> # append or shift left, shift right + | <=?>? | >=? # comparison, rocket operator + | ===? | =~ # simple equality, case equality, match + | ![~=@]? # negation with and without at sign, not-equal and not-match + /ox + METHOD_SUFFIX = / (?: [?!] | = (?![~>]|=(?!>)) ) /x + METHOD_NAME_EX = / #{IDENT} #{METHOD_SUFFIX}? | #{METHOD_NAME_OPERATOR} /ox + METHOD_AFTER_DOT = / #{IDENT} [?!]? | #{METHOD_NAME_OPERATOR} /ox + INSTANCE_VARIABLE = / @ #{IDENT} /ox + CLASS_VARIABLE = / @@ #{IDENT} /ox + OBJECT_VARIABLE = / @@? #{IDENT} /ox + GLOBAL_VARIABLE = / \$ (?: #{IDENT} | [1-9]\d* | 0\w* | [~&+`'=\/,;_.<>!@$?*":\\] | -[a-zA-Z_0-9] ) /ox + PREFIX_VARIABLE = / #{GLOBAL_VARIABLE} | #{OBJECT_VARIABLE} /ox + VARIABLE = / @?@? #{IDENT} | #{GLOBAL_VARIABLE} /ox + + QUOTE_TO_TYPE = { + '`' => :shell, + '/'=> :regexp, + } + QUOTE_TO_TYPE.default = :string + + REGEXP_MODIFIERS = /[mousenix]*/ + + DECIMAL = /\d+(?:_\d+)*/ + OCTAL = /0_?[0-7]+(?:_[0-7]+)*/ + HEXADECIMAL = /0x[0-9A-Fa-f]+(?:_[0-9A-Fa-f]+)*/ + BINARY = /0b[01]+(?:_[01]+)*/ + + EXPONENT = / [eE] [+-]? #{DECIMAL} /ox + FLOAT_SUFFIX = / #{EXPONENT} | \. #{DECIMAL} #{EXPONENT}? /ox + FLOAT_OR_INT = / #{DECIMAL} (?: #{FLOAT_SUFFIX} () )? /ox + NUMERIC = / (?: (?=0) (?: #{OCTAL} | #{HEXADECIMAL} | #{BINARY} ) | #{FLOAT_OR_INT} ) /ox + + SYMBOL = / + : + (?: + #{METHOD_NAME_EX} + | #{PREFIX_VARIABLE} + | ['"] + ) + /ox + METHOD_NAME_OR_SYMBOL = / #{METHOD_NAME_EX} | #{SYMBOL} /ox + + SIMPLE_ESCAPE = / + [abefnrstv] + | [0-7]{1,3} + | x[0-9A-Fa-f]{1,2} + | . + /mx + + CONTROL_META_ESCAPE = / + (?: M-|C-|c ) + (?: \\ (?: M-|C-|c ) )* + (?: [^\\] | \\ #{SIMPLE_ESCAPE} )? + /mox + + ESCAPE = / + #{CONTROL_META_ESCAPE} | #{SIMPLE_ESCAPE} + /mox + + CHARACTER = / + \? + (?: + [^\s\\] + | \\ #{ESCAPE} + ) + /mox + + # NOTE: This is not completely correct, but + # nobody needs heredoc delimiters ending with \n. + HEREDOC_OPEN = / + << (-)? # $1 = float + (?: + ( [A-Za-z_0-9]+ ) # $2 = delim + | + ( ["'`\/] ) # $3 = quote, type + ( [^\n]*? ) \3 # $4 = delim + ) + /mx + + RUBYDOC = / + =begin (?!\S) + .*? + (?: \Z | ^=end (?!\S) [^\n]* ) + /mx + + DATA = / + __END__$ + .*? + (?: \Z | (?=^\#CODE) ) + /mx + + RUBYDOC_OR_DATA = / #{RUBYDOC} | #{DATA} /xo + + # Checks for a valid value to follow. This enables + # value_expected in method calls without parentheses. + VALUE_FOLLOWS = / + (?>[ \t\f\v]+) + (?: + [%\/][^\s=] + | <<-?\S + | [-+] \d + | #{CHARACTER} + ) + /ox + KEYWORDS_EXPECTING_VALUE = WordList.new.add(%w[ + and end in or unless begin + defined? ensure redo super until + break do next rescue then + when case else for retry + while elsif if not return + yield + ]) + + FANCY_STRING_START = / % ( [iIqQrswWx] | (?![a-zA-Z0-9]) ) ([^a-zA-Z0-9]) /x + FANCY_STRING_KIND = Hash.new(:string).merge({ + 'i' => :symbol, + 'I' => :symbol, + 'r' => :regexp, + 's' => :symbol, + 'x' => :shell, + }) + FANCY_STRING_INTERPRETED = Hash.new(true).merge({ + 'i' => false, + 'q' => false, + 's' => false, + 'w' => false, + }) + + end + +end +end diff --git a/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/ruby/string_state.rb b/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/ruby/string_state.rb new file mode 100644 index 0000000..28ddd6c --- /dev/null +++ b/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/ruby/string_state.rb @@ -0,0 +1,71 @@ +# encoding: utf-8 +module CodeRay +module Scanners + + class Ruby + + class StringState < Struct.new :type, :interpreted, :delim, :heredoc, + :opening_paren, :paren_depth, :pattern, :next_state # :nodoc: all + + CLOSING_PAREN = Hash[ *%w[ + ( ) + [ ] + < > + { } + ] ].each { |k,v| k.freeze; v.freeze } # debug, if I try to change it with << + + STRING_PATTERN = Hash.new do |h, k| + delim, interpreted = *k + delim_pattern = Regexp.escape(delim) + if closing_paren = CLOSING_PAREN[delim] + delim_pattern << Regexp.escape(closing_paren) + end + delim_pattern << '\\\\' unless delim == '\\' + + # special_escapes = + # case interpreted + # when :regexp_symbols + # '| [|?*+(){}\[\].^$]' + # end + + if interpreted && delim != '#' + / (?= [#{delim_pattern}] | \# [{$@] ) /mx + else + / (?= [#{delim_pattern}] ) /mx + end.tap do |pattern| + h[k] = pattern if (delim.respond_to?(:ord) ? delim.ord : delim[0]) < 256 + end + end + + def initialize kind, interpreted, delim, heredoc = false + if heredoc + pattern = heredoc_pattern delim, interpreted, heredoc == :indented + delim = nil + else + pattern = STRING_PATTERN[ [delim, interpreted] ] + if closing_paren = CLOSING_PAREN[delim] + opening_paren = delim + delim = closing_paren + paren_depth = 1 + end + end + super kind, interpreted, delim, heredoc, opening_paren, paren_depth, pattern, :initial + end + + def heredoc_pattern delim, interpreted, indented + # delim = delim.dup # workaround for old Ruby + delim_pattern = Regexp.escape(delim) + delim_pattern = / (?:\A|\n) #{ '(?>[ \t]*)' if indented } #{ Regexp.new delim_pattern } $ /x + if interpreted + / (?= #{delim_pattern}() | \\ | \# [{$@] ) /mx # $1 set == end of heredoc + else + / (?= #{delim_pattern}() | \\ ) /mx + end + end + + end + + end + +end +end diff --git a/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/sass.rb b/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/sass.rb new file mode 100644 index 0000000..e3296b9 --- /dev/null +++ b/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/sass.rb @@ -0,0 +1,232 @@ +module CodeRay +module Scanners + + # A scanner for Sass. + class Sass < CSS + + register_for :sass + file_extension 'sass' + + protected + + def setup + @state = :initial + end + + def scan_tokens encoder, options + states = Array(options[:state] || @state).dup + + encoder.begin_group :string if states.last == :sqstring || states.last == :dqstring + + until eos? + + if bol? && (match = scan(/(?>( +)?(\/[\*\/])(.+)?)(?=\n)/)) + encoder.text_token self[1], :space if self[1] + encoder.begin_group :comment + encoder.text_token self[2], :delimiter + encoder.text_token self[3], :content if self[3] + if match = scan(/(?:\n+#{self[1]} .*)+/) + encoder.text_token match, :content + end + encoder.end_group :comment + elsif match = scan(/\n|[^\n\S]+\n?/) + encoder.text_token match, :space + if match.index(/\n/) + value_expected = false + states.pop if states.last == :include + end + + elsif states.last == :sass_inline && (match = scan(/\}/)) + encoder.text_token match, :inline_delimiter + encoder.end_group :inline + states.pop + + elsif case states.last + when :initial, :media, :sass_inline + if match = scan(/(?>#{RE::Ident})(?!\()/ox) + encoder.text_token match, value_expected ? :value : (check(/.*:(?![a-z])/) ? :key : :tag) + next + elsif !value_expected && (match = scan(/\*/)) + encoder.text_token match, :tag + next + elsif match = scan(RE::Class) + encoder.text_token match, :class + next + elsif match = scan(RE::Id) + encoder.text_token match, :id + next + elsif match = scan(RE::PseudoClass) + encoder.text_token match, :pseudo_class + next + elsif match = scan(RE::AttributeSelector) + # TODO: Improve highlighting inside of attribute selectors. + encoder.text_token match[0,1], :operator + encoder.text_token match[1..-2], :attribute_name if match.size > 2 + encoder.text_token match[-1,1], :operator if match[-1] == ?] + next + elsif match = scan(/(\=|@mixin +)#{RE::Ident}/o) + encoder.text_token match, :function + next + elsif match = scan(/@import\b/) + encoder.text_token match, :directive + states << :include + next + elsif match = scan(/@media\b/) + encoder.text_token match, :directive + # states.push :media_before_name + next + end + + when :block + if match = scan(/(?>#{RE::Ident})(?!\()/ox) + if value_expected + encoder.text_token match, :value + else + encoder.text_token match, :key + end + next + end + + when :sqstring, :dqstring + if match = scan(states.last == :sqstring ? /(?:[^\n\'\#]+|\\\n|#{RE::Escape}|#(?!\{))+/o : /(?:[^\n\"\#]+|\\\n|#{RE::Escape}|#(?!\{))+/o) + encoder.text_token match, :content + elsif match = scan(/['"]/) + encoder.text_token match, :delimiter + encoder.end_group :string + states.pop + elsif match = scan(/#\{/) + encoder.begin_group :inline + encoder.text_token match, :inline_delimiter + states.push :sass_inline + elsif match = scan(/ \\ | $ /x) + encoder.end_group states.last + encoder.text_token match, :error unless match.empty? + states.pop + else + raise_inspect "else case #{states.last} reached; %p not handled." % peek(1), encoder + end + + when :include + if match = scan(/[^\s'",]+/) + encoder.text_token match, :include + next + end + + else + #:nocov: + raise_inspect 'Unknown state: %p' % [states.last], encoder + #:nocov: + + end + + elsif match = scan(/\$#{RE::Ident}/o) + encoder.text_token match, :variable + next + + elsif match = scan(/&/) + encoder.text_token match, :local_variable + + elsif match = scan(/\+#{RE::Ident}/o) + encoder.text_token match, :include + value_expected = true + + elsif match = scan(/\/\*(?:.*?\*\/|.*)|\/\/.*/) + encoder.text_token match, :comment + + elsif match = scan(/#\{/) + encoder.begin_group :inline + encoder.text_token match, :inline_delimiter + states.push :sass_inline + + elsif match = scan(/\{/) + value_expected = false + encoder.text_token match, :operator + states.push :block + + elsif match = scan(/\}/) + value_expected = false + encoder.text_token match, :operator + if states.last == :block || states.last == :media + states.pop + end + + elsif match = scan(/['"]/) + encoder.begin_group :string + encoder.text_token match, :delimiter + if states.include? :sass_inline + # no nesting, just scan the string until delimiter + content = scan_until(/(?=#{match}|\}|\z)/) + encoder.text_token content, :content unless content.empty? + encoder.text_token match, :delimiter if scan(/#{match}/) + encoder.end_group :string + else + states.push match == "'" ? :sqstring : :dqstring + end + + elsif match = scan(/#{RE::Function}/o) + encoder.begin_group :function + start = match[/^[-\w]+\(/] + encoder.text_token start, :delimiter + if match[-1] == ?) + encoder.text_token match[start.size..-2], :content + encoder.text_token ')', :delimiter + else + encoder.text_token match[start.size..-1], :content if start.size < match.size + end + encoder.end_group :function + + elsif match = scan(/[a-z][-a-z_]*(?=\()/o) + encoder.text_token match, :predefined + + elsif match = scan(/(?: #{RE::Dimension} | #{RE::Percentage} | #{RE::Num} )/ox) + encoder.text_token match, :float + + elsif match = scan(/#{RE::HexColor}/o) + encoder.text_token match, :color + + elsif match = scan(/! *(?:important|optional)/) + encoder.text_token match, :important + + elsif match = scan(/(?:rgb|hsl)a?\([^()\n]*\)?/) + encoder.text_token match, :color + + elsif match = scan(/@else if\b|#{RE::AtKeyword}/o) + encoder.text_token match, :directive + value_expected = true + + elsif match = scan(/ == | != | [-+*\/>~:;,.=()] /x) + if match == ':' + value_expected = true + elsif match == ';' + value_expected = false + end + encoder.text_token match, :operator + + else + encoder.text_token getch, :error + + end + + end + + states.pop if states.last == :include + + if options[:keep_state] + @state = states.dup + end + + while state = states.pop + if state == :sass_inline + encoder.end_group :inline + elsif state == :sqstring || state == :dqstring + encoder.end_group :string + end + end + + encoder + end + + end + +end +end diff --git a/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/sql.rb b/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/sql.rb new file mode 100644 index 0000000..93aeaf3 --- /dev/null +++ b/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/sql.rb @@ -0,0 +1,177 @@ +module CodeRay +module Scanners + + # by Josh Goebel + class SQL < Scanner + + register_for :sql + + KEYWORDS = %w( + all and any as before begin between by case check collate + each else end exists + for foreign from full group having if in inner is join + like not of on or order outer over references + then to union using values when where + left right distinct + ) + + OBJECTS = %w( + database databases table tables column columns fields index constraint + constraints transaction function procedure row key view trigger + ) + + COMMANDS = %w( + add alter comment create delete drop grant insert into select update set + show prompt begin commit rollback replace truncate + ) + + PREDEFINED_TYPES = %w( + char varchar varchar2 enum binary text tinytext mediumtext + longtext blob tinyblob mediumblob longblob timestamp + date time datetime year double decimal float int + integer tinyint mediumint bigint smallint unsigned bit + bool boolean hex bin oct + ) + + PREDEFINED_FUNCTIONS = %w( sum cast substring abs pi count min max avg now ) + + DIRECTIVES = %w( + auto_increment unique default charset initially deferred + deferrable cascade immediate read write asc desc after + primary foreign return engine + ) + + PREDEFINED_CONSTANTS = %w( null true false ) + + IDENT_KIND = WordList::CaseIgnoring.new(:ident). + add(KEYWORDS, :keyword). + add(OBJECTS, :type). + add(COMMANDS, :class). + add(PREDEFINED_TYPES, :predefined_type). + add(PREDEFINED_CONSTANTS, :predefined_constant). + add(PREDEFINED_FUNCTIONS, :predefined). + add(DIRECTIVES, :directive) + + ESCAPE = / [rbfntv\n\\\/'"] | x[a-fA-F0-9]{1,2} | [0-7]{1,3} | . /mx + UNICODE_ESCAPE = / u[a-fA-F0-9]{4} | U[a-fA-F0-9]{8} /x + + STRING_PREFIXES = /[xnb]|_\w+/i + + def scan_tokens encoder, options + + state = :initial + string_type = nil + string_content = '' + name_expected = false + + until eos? + + if state == :initial + + if match = scan(/ \s+ | \\\n /x) + encoder.text_token match, :space + + elsif match = scan(/(?:--\s?|#).*/) + encoder.text_token match, :comment + + elsif match = scan(%r( /\* (!)? (?: .*? \*/ | .* ) )mx) + encoder.text_token match, self[1] ? :directive : :comment + + elsif match = scan(/ [*\/=<>:;,!&^|()\[\]{}~%] | [-+\.](?!\d) /x) + name_expected = true if match == '.' && check(/[A-Za-z_]/) + encoder.text_token match, :operator + + elsif match = scan(/(#{STRING_PREFIXES})?([`"'])/o) + prefix = self[1] + string_type = self[2] + encoder.begin_group :string + encoder.text_token prefix, :modifier if prefix + match = string_type + state = :string + encoder.text_token match, :delimiter + + elsif match = scan(/ @? [A-Za-z_][A-Za-z_0-9]* /x) + encoder.text_token match, name_expected ? :ident : (match[0] == ?@ ? :variable : IDENT_KIND[match]) + name_expected = false + + elsif match = scan(/0[xX][0-9A-Fa-f]+/) + encoder.text_token match, :hex + + elsif match = scan(/0[0-7]+(?![89.eEfF])/) + encoder.text_token match, :octal + + elsif match = scan(/[-+]?(?>\d+)(?![.eEfF])/) + encoder.text_token match, :integer + + elsif match = scan(/[-+]?(?:\d[fF]|\d*\.\d+(?:[eE][+-]?\d+)?|\d+[eE][+-]?\d+)/) + encoder.text_token match, :float + + elsif match = scan(/\\N/) + encoder.text_token match, :predefined_constant + + else + encoder.text_token getch, :error + + end + + elsif state == :string + if match = scan(/[^\\"'`]+/) + string_content << match + next + elsif match = scan(/["'`]/) + if string_type == match + if peek(1) == string_type # doubling means escape + string_content << string_type << getch + next + end + unless string_content.empty? + encoder.text_token string_content, :content + string_content = '' + end + encoder.text_token match, :delimiter + encoder.end_group :string + state = :initial + string_type = nil + else + string_content << match + end + elsif match = scan(/ \\ (?: #{ESCAPE} | #{UNICODE_ESCAPE} ) /mox) + unless string_content.empty? + encoder.text_token string_content, :content + string_content = '' + end + encoder.text_token match, :char + elsif match = scan(/ \\ . /mox) + string_content << match + next + elsif match = scan(/ \\ | $ /x) + unless string_content.empty? + encoder.text_token string_content, :content + string_content = '' + end + encoder.text_token match, :error unless match.empty? + encoder.end_group :string + state = :initial + else + raise "else case \" reached; %p not handled." % peek(1), encoder + end + + else + raise 'else-case reached', encoder + + end + + end + + if state == :string + encoder.end_group state + end + + encoder + + end + + end + +end +end diff --git a/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/taskpaper.rb b/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/taskpaper.rb new file mode 100644 index 0000000..42670bc --- /dev/null +++ b/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/taskpaper.rb @@ -0,0 +1,36 @@ +module CodeRay +module Scanners + + class Taskpaper < Scanner + + register_for :taskpaper + file_extension 'taskpaper' + + protected + + def scan_tokens encoder, options + until eos? + if match = scan(/\S.*:.*$/) # project + encoder.text_token(match, :namespace) + elsif match = scan(/-.+@done.*/) # completed task + encoder.text_token(match, :done) + elsif match = scan(/-(?:[^@\n]+|@(?!due))*/) # task + encoder.text_token(match, :plain) + elsif match = scan(/@due.*/) # comment + encoder.text_token(match, :important) + elsif match = scan(/.+/) # comment + encoder.text_token(match, :comment) + elsif match = scan(/\s+/) # space + encoder.text_token(match, :space) + else # other + encoder.text_token getch, :error + end + end + + encoder + end + + end + +end +end diff --git a/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/text.rb b/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/text.rb new file mode 100644 index 0000000..bde9029 --- /dev/null +++ b/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/text.rb @@ -0,0 +1,26 @@ +module CodeRay + module Scanners + + # Scanner for plain text. + # + # Yields just one token of the kind :plain. + # + # Alias: +plaintext+, +plain+ + class Text < Scanner + + register_for :text + title 'Plain text' + + KINDS_NOT_LOC = [:plain] # :nodoc: + + protected + + def scan_tokens encoder, options + encoder.text_token string, :plain + encoder + end + + end + + end +end diff --git a/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/xml.rb b/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/xml.rb new file mode 100644 index 0000000..947f16e --- /dev/null +++ b/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/xml.rb @@ -0,0 +1,17 @@ +module CodeRay +module Scanners + + load :html + + # Scanner for XML. + # + # Currently this is the same scanner as Scanners::HTML. + class XML < HTML + + register_for :xml + file_extension 'xml' + + end + +end +end diff --git a/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/yaml.rb b/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/yaml.rb new file mode 100644 index 0000000..32c8e2c --- /dev/null +++ b/.bundle/gems/coderay-1.1.0/lib/coderay/scanners/yaml.rb @@ -0,0 +1,140 @@ +module CodeRay +module Scanners + + # Scanner for YAML. + # + # Based on the YAML scanner from Syntax by Jamis Buck. + class YAML < Scanner + + register_for :yaml + file_extension 'yml' + + KINDS_NOT_LOC = :all + + protected + + def scan_tokens encoder, options + + state = :initial + key_indent = string_indent = 0 + + until eos? + + key_indent = nil if bol? + + if match = scan(/ +[\t ]*/) + encoder.text_token match, :space + + elsif match = scan(/\n+/) + encoder.text_token match, :space + state = :initial if match.index(?\n) + + elsif match = scan(/#.*/) + encoder.text_token match, :comment + + elsif bol? and case + when match = scan(/---|\.\.\./) + encoder.begin_group :head + encoder.text_token match, :head + encoder.end_group :head + next + when match = scan(/%.*/) + encoder.text_token match, :doctype + next + end + + elsif state == :value and case + when !check(/(?:"[^"]*")(?=: |:$)/) && match = scan(/"/) + encoder.begin_group :string + encoder.text_token match, :delimiter + encoder.text_token match, :content if (match = scan(/ [^"\\]* (?: \\. [^"\\]* )* /mx)) && !match.empty? + encoder.text_token match, :delimiter if match = scan(/"/) + encoder.end_group :string + next + when match = scan(/[|>][-+]?/) + encoder.begin_group :string + encoder.text_token match, :delimiter + string_indent = key_indent || column(pos - match.size) - 1 + encoder.text_token matched, :content if scan(/(?:\n+ {#{string_indent + 1}}.*)+/) + encoder.end_group :string + next + when match = scan(/(?![!"*&]).+?(?=$|\s+#)/) + encoder.begin_group :string + encoder.text_token match, :content + string_indent = key_indent || column(pos - match.size) - 1 + encoder.text_token matched, :content if scan(/(?:\n+ {#{string_indent + 1}}.*)+/) + encoder.end_group :string + next + end + + elsif case + when match = scan(/[-:](?= |$)/) + state = :value if state == :colon && (match == ':' || match == '-') + state = :value if state == :initial && match == '-' + encoder.text_token match, :operator + next + when match = scan(/[,{}\[\]]/) + encoder.text_token match, :operator + next + when state == :initial && match = scan(/[-\w.()\/ ]*\S(?= *:(?: |$))/) + encoder.text_token match, :key + key_indent = column(pos - match.size) - 1 + state = :colon + next + when match = scan(/(?:"[^"\n]*"|'[^'\n]*')(?= *:(?: |$))/) + encoder.begin_group :key + encoder.text_token match[0,1], :delimiter + encoder.text_token match[1..-2], :content if match.size > 2 + encoder.text_token match[-1,1], :delimiter + encoder.end_group :key + key_indent = column(pos - match.size) - 1 + state = :colon + next + when match = scan(/(![\w\/]+)(:([\w:]+))?/) + encoder.text_token self[1], :type + if self[2] + encoder.text_token ':', :operator + encoder.text_token self[3], :class + end + next + when match = scan(/&\S+/) + encoder.text_token match, :variable + next + when match = scan(/\*\w+/) + encoder.text_token match, :global_variable + next + when match = scan(/<) + encoder.text_token match, :class_variable + next + when match = scan(/\d\d:\d\d:\d\d/) + encoder.text_token match, :octal + next + when match = scan(/\d\d\d\d-\d\d-\d\d\s\d\d:\d\d:\d\d(\.\d+)? [-+]\d\d:\d\d/) + encoder.text_token match, :octal + next + when match = scan(/:\w+/) + encoder.text_token match, :symbol + next + when match = scan(/[^:\s]+(:(?! |$)[^:\s]*)* .*/) + encoder.text_token match, :error + next + when match = scan(/[^:\s]+(:(?! |$)[^:\s]*)*/) + encoder.text_token match, :error + next + end + + else + raise if eos? + encoder.text_token getch, :error + + end + + end + + encoder + end + + end + +end +end diff --git a/.bundle/gems/coderay-1.1.0/lib/coderay/style.rb b/.bundle/gems/coderay-1.1.0/lib/coderay/style.rb new file mode 100644 index 0000000..df4704f --- /dev/null +++ b/.bundle/gems/coderay-1.1.0/lib/coderay/style.rb @@ -0,0 +1,23 @@ +module CodeRay + + # This module holds the Style class and its subclasses. + # + # See Plugin. + module Styles + extend PluginHost + plugin_path File.dirname(__FILE__), 'styles' + + # Base class for styles. + # + # Styles are used by Encoders::HTML to colorize tokens. + class Style + extend Plugin + plugin_host Styles + + DEFAULT_OPTIONS = { } # :nodoc: + + end + + end + +end diff --git a/.bundle/gems/coderay-1.1.0/lib/coderay/styles/_map.rb b/.bundle/gems/coderay-1.1.0/lib/coderay/styles/_map.rb new file mode 100644 index 0000000..92d4354 --- /dev/null +++ b/.bundle/gems/coderay-1.1.0/lib/coderay/styles/_map.rb @@ -0,0 +1,7 @@ +module CodeRay +module Styles + + default :alpha + +end +end diff --git a/.bundle/gems/coderay-1.1.0/lib/coderay/styles/alpha.rb b/.bundle/gems/coderay-1.1.0/lib/coderay/styles/alpha.rb new file mode 100644 index 0000000..d304dc4 --- /dev/null +++ b/.bundle/gems/coderay-1.1.0/lib/coderay/styles/alpha.rb @@ -0,0 +1,152 @@ +module CodeRay +module Styles + + # A colorful theme using CSS 3 colors (with alpha channel). + class Alpha < Style + + register_for :alpha + + code_background = 'hsl(0,0%,95%)' + numbers_background = 'hsl(180,65%,90%)' + border_color = 'silver' + normal_color = 'black' + + CSS_MAIN_STYLES = <<-MAIN # :nodoc: +.CodeRay { + background-color: #{code_background}; + border: 1px solid #{border_color}; + color: #{normal_color}; +} +.CodeRay pre { + margin: 0px; +} + +span.CodeRay { white-space: pre; border: 0px; padding: 2px; } + +table.CodeRay { border-collapse: collapse; width: 100%; padding: 2px; } +table.CodeRay td { padding: 2px 4px; vertical-align: top; } + +.CodeRay .line-numbers { + background-color: #{numbers_background}; + color: gray; + text-align: right; + -webkit-user-select: none; + -moz-user-select: none; + user-select: none; +} +.CodeRay .line-numbers a { + background-color: #{numbers_background} !important; + color: gray !important; + text-decoration: none !important; +} +.CodeRay .line-numbers pre { + word-break: normal; +} +.CodeRay .line-numbers a:target { color: blue !important; } +.CodeRay .line-numbers .highlighted { color: red !important; } +.CodeRay .line-numbers .highlighted a { color: red !important; } +.CodeRay span.line-numbers { padding: 0px 4px; } +.CodeRay .line { display: block; float: left; width: 100%; } +.CodeRay .code { width: 100%; } + MAIN + + TOKEN_COLORS = <<-'TOKENS' +.debug { color: white !important; background: blue !important; } + +.annotation { color:#007 } +.attribute-name { color:#b48 } +.attribute-value { color:#700 } +.binary { color:#549 } +.binary .char { color:#325 } +.binary .delimiter { color:#325 } +.char { color:#D20 } +.char .content { color:#D20 } +.char .delimiter { color:#710 } +.class { color:#B06; font-weight:bold } +.class-variable { color:#369 } +.color { color:#0A0 } +.comment { color:#777 } +.comment .char { color:#444 } +.comment .delimiter { color:#444 } +.constant { color:#036; font-weight:bold } +.decorator { color:#B0B } +.definition { color:#099; font-weight:bold } +.delimiter { color:black } +.directive { color:#088; font-weight:bold } +.docstring { color:#D42; } +.doctype { color:#34b } +.done { text-decoration: line-through; color: gray } +.entity { color:#800; font-weight:bold } +.error { color:#F00; background-color:#FAA } +.escape { color:#666 } +.exception { color:#C00; font-weight:bold } +.float { color:#60E } +.function { color:#06B; font-weight:bold } +.function .delimiter { color:#024; font-weight:bold } +.global-variable { color:#d70 } +.hex { color:#02b } +.id { color:#33D; font-weight:bold } +.include { color:#B44; font-weight:bold } +.inline { background-color: hsla(0,0%,0%,0.07); color: black } +.inline-delimiter { font-weight: bold; color: #666 } +.instance-variable { color:#33B } +.integer { color:#00D } +.imaginary { color:#f00 } +.important { color:#D00 } +.key { color: #606 } +.key .char { color: #60f } +.key .delimiter { color: #404 } +.keyword { color:#080; font-weight:bold } +.label { color:#970; font-weight:bold } +.local-variable { color:#950 } +.map .content { color:#808 } +.map .delimiter { color:#40A} +.map { background-color:hsla(200,100%,50%,0.06); } +.namespace { color:#707; font-weight:bold } +.octal { color:#40E } +.operator { } +.predefined { color:#369; font-weight:bold } +.predefined-constant { color:#069 } +.predefined-type { color:#0a8; font-weight:bold } +.preprocessor { color:#579 } +.pseudo-class { color:#00C; font-weight:bold } +.regexp { background-color:hsla(300,100%,50%,0.06); } +.regexp .content { color:#808 } +.regexp .delimiter { color:#404 } +.regexp .modifier { color:#C2C } +.reserved { color:#080; font-weight:bold } +.shell { background-color:hsla(120,100%,50%,0.06); } +.shell .content { color:#2B2 } +.shell .delimiter { color:#161 } +.string { background-color:hsla(0,100%,50%,0.05); } +.string .char { color: #b0b } +.string .content { color: #D20 } +.string .delimiter { color: #710 } +.string .modifier { color: #E40 } +.symbol { color:#A60 } +.symbol .content { color:#A60 } +.symbol .delimiter { color:#740 } +.tag { color:#070; font-weight:bold } +.type { color:#339; font-weight:bold } +.value { color: #088 } +.variable { color:#037 } + +.insert { background: hsla(120,100%,50%,0.12) } +.delete { background: hsla(0,100%,50%,0.12) } +.change { color: #bbf; background: #007 } +.head { color: #f8f; background: #505 } +.head .filename { color: white; } + +.delete .eyecatcher { background-color: hsla(0,100%,50%,0.2); border: 1px solid hsla(0,100%,45%,0.5); margin: -1px; border-bottom: none; border-top-left-radius: 5px; border-top-right-radius: 5px; } +.insert .eyecatcher { background-color: hsla(120,100%,50%,0.2); border: 1px solid hsla(120,100%,25%,0.5); margin: -1px; border-top: none; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; } + +.insert .insert { color: #0c0; background:transparent; font-weight:bold } +.delete .delete { color: #c00; background:transparent; font-weight:bold } +.change .change { color: #88f } +.head .head { color: #f4f } + TOKENS + + end + +end +end diff --git a/.bundle/gems/coderay-1.1.0/lib/coderay/token_kinds.rb b/.bundle/gems/coderay-1.1.0/lib/coderay/token_kinds.rb new file mode 100755 index 0000000..f911862 --- /dev/null +++ b/.bundle/gems/coderay-1.1.0/lib/coderay/token_kinds.rb @@ -0,0 +1,85 @@ +module CodeRay + + # A Hash of all known token kinds and their associated CSS classes. + TokenKinds = Hash.new(false) + + # speedup + TokenKinds.compare_by_identity if TokenKinds.respond_to? :compare_by_identity + + TokenKinds.update( # :nodoc: + :debug => 'debug', # highlight for debugging (white on blue background) + + :annotation => 'annotation', # Groovy, Java + :attribute_name => 'attribute-name', # HTML, CSS + :attribute_value => 'attribute-value', # HTML + :binary => 'binary', # Python, Ruby + :char => 'char', # most scanners, also inside of strings + :class => 'class', # lots of scanners, for different purposes also in CSS + :class_variable => 'class-variable', # Ruby, YAML + :color => 'color', # CSS + :comment => 'comment', # most scanners + :constant => 'constant', # PHP, Ruby + :content => 'content', # inside of strings, most scanners + :decorator => 'decorator', # Python + :definition => 'definition', # CSS + :delimiter => 'delimiter', # inside strings, comments and other types + :directive => 'directive', # lots of scanners + :doctype => 'doctype', # Goorvy, HTML, Ruby, YAML + :docstring => 'docstring', # Python + :done => 'done', # Taskpaper + :entity => 'entity', # HTML + :error => 'error', # invalid token, most scanners + :escape => 'escape', # Ruby (string inline variables like #$foo, #@bar) + :exception => 'exception', # Java, PHP, Python + :filename => 'filename', # Diff + :float => 'float', # most scanners + :function => 'function', # CSS, JavaScript, PHP + :global_variable => 'global-variable', # Ruby, YAML + :hex => 'hex', # hexadecimal number; lots of scanners + :id => 'id', # CSS + :imaginary => 'imaginary', # Python + :important => 'important', # CSS, Taskpaper + :include => 'include', # C, Groovy, Java, Python, Sass + :inline => 'inline', # nested code, eg. inline string evaluation; lots of scanners + :inline_delimiter => 'inline-delimiter', # used instead of :inline > :delimiter FIXME: Why use inline_delimiter? + :instance_variable => 'instance-variable', # Ruby + :integer => 'integer', # most scanners + :key => 'key', # lots of scanners, used together with :value + :keyword => 'keyword', # reserved word that's actually implemented; most scanners + :label => 'label', # C, PHP + :local_variable => 'local-variable', # local and magic variables; some scanners + :map => 'map', # Lua tables + :modifier => 'modifier', # used inside on strings; lots of scanners + :namespace => 'namespace', # Clojure, Java, Taskpaper + :octal => 'octal', # lots of scanners + :predefined => 'predefined', # predefined function: lots of scanners + :predefined_constant => 'predefined-constant',# lots of scanners + :predefined_type => 'predefined-type', # C, Java, PHP + :preprocessor => 'preprocessor', # C, Delphi, HTML + :pseudo_class => 'pseudo-class', # CSS + :regexp => 'regexp', # Groovy, JavaScript, Ruby + :reserved => 'reserved', # most scanners + :shell => 'shell', # Ruby + :string => 'string', # most scanners + :symbol => 'symbol', # Clojure, Ruby, YAML + :tag => 'tag', # CSS, HTML + :type => 'type', # CSS, Java, SQL, YAML + :value => 'value', # used together with :key; CSS, JSON, YAML + :variable => 'variable', # Sass, SQL, YAML + + :change => 'change', # Diff + :delete => 'delete', # Diff + :head => 'head', # Diff, YAML + :insert => 'insert', # Diff + :eyecatcher => 'eyecatcher', # Diff + + :ident => false, # almost all scanners + :operator => false, # almost all scanners + + :space => false, # almost all scanners + :plain => false # almost all scanners + ) + + TokenKinds[:method] = TokenKinds[:function] + TokenKinds[:unknown] = TokenKinds[:plain] +end diff --git a/.bundle/gems/coderay-1.1.0/lib/coderay/tokens.rb b/.bundle/gems/coderay-1.1.0/lib/coderay/tokens.rb new file mode 100644 index 0000000..e7bffce --- /dev/null +++ b/.bundle/gems/coderay-1.1.0/lib/coderay/tokens.rb @@ -0,0 +1,161 @@ +module CodeRay + + # The Tokens class represents a list of tokens returned from + # a Scanner. It's actually just an Array with a few helper methods. + # + # A token itself is not a special object, just two elements in an Array: + # * the _token_ _text_ (the original source of the token in a String) or + # a _token_ _action_ (begin_group, end_group, begin_line, end_line) + # * the _token_ _kind_ (a Symbol representing the type of the token) + # + # It looks like this: + # + # ..., '# It looks like this', :comment, ... + # ..., '3.1415926', :float, ... + # ..., '$^', :error, ... + # + # Some scanners also yield sub-tokens, represented by special + # token actions, for example :begin_group and :end_group. + # + # The Ruby scanner, for example, splits "a string" into: + # + # [ + # :begin_group, :string, + # '"', :delimiter, + # 'a string', :content, + # '"', :delimiter, + # :end_group, :string + # ] + # + # Tokens can be used to save the output of a Scanners in a simple + # Ruby object that can be send to an Encoder later: + # + # tokens = CodeRay.scan('price = 2.59', :ruby).tokens + # tokens.encode(:html) + # tokens.html + # CodeRay.encoder(:html).encode_tokens(tokens) + # + # Tokens gives you the power to handle pre-scanned code very easily: + # You can serialize it to a JSON string and store it in a database, pass it + # around to encode it more than once, send it to other algorithms... + class Tokens < Array + + # The Scanner instance that created the tokens. + attr_accessor :scanner + + # Encode the tokens using encoder. + # + # encoder can be + # * a plugin name like :html oder 'statistic' + # * an Encoder object + # + # options are passed to the encoder. + def encode encoder, options = {} + encoder = Encoders[encoder].new options if encoder.respond_to? :to_sym + encoder.encode_tokens self, options + end + + # Turn tokens into a string by concatenating them. + def to_s + encode CodeRay::Encoders::Encoder.new + end + + # Redirects unknown methods to encoder calls. + # + # For example, if you call +tokens.html+, the HTML encoder + # is used to highlight the tokens. + def method_missing meth, options = {} + encode meth, options + rescue PluginHost::PluginNotFound + super + end + + # Split the tokens into parts of the given +sizes+. + # + # The result will be an Array of Tokens objects. The parts have + # the text size specified by the parameter. In addition, each + # part closes all opened tokens. This is useful to insert tokens + # betweem them. + # + # This method is used by @Scanner#tokenize@ when called with an Array + # of source strings. The Diff encoder uses it for inline highlighting. + def split_into_parts *sizes + return Array.new(sizes.size) { Tokens.new } if size == 2 && first == '' + parts = [] + opened = [] + content = nil + part = Tokens.new + part_size = 0 + size = sizes.first + i = 0 + for item in self + case content + when nil + content = item + when String + if size && part_size + content.size > size # token must be cut + if part_size < size # some part of the token goes into this part + content = content.dup # content may no be safe to change + part << content.slice!(0, size - part_size) << item + end + # close all open groups and lines... + closing = opened.reverse.flatten.map do |content_or_kind| + case content_or_kind + when :begin_group + :end_group + when :begin_line + :end_line + else + content_or_kind + end + end + part.concat closing + begin + parts << part + part = Tokens.new + size = sizes[i += 1] + end until size.nil? || size > 0 + # ...and open them again. + part.concat opened.flatten + part_size = 0 + redo unless content.empty? + else + part << content << item + part_size += content.size + end + content = nil + when Symbol + case content + when :begin_group, :begin_line + opened << [content, item] + when :end_group, :end_line + opened.pop + else + raise ArgumentError, 'Unknown token action: %p, kind = %p' % [content, item] + end + part << content << item + content = nil + else + raise ArgumentError, 'Token input junk: %p, kind = %p' % [content, item] + end + end + parts << part + parts << Tokens.new while parts.size < sizes.size + parts + end + + # Return the actual number of tokens. + def count + size / 2 + end + + alias text_token push + def begin_group kind; push :begin_group, kind end + def end_group kind; push :end_group, kind end + def begin_line kind; push :begin_line, kind end + def end_line kind; push :end_line, kind end + alias tokens concat + + end + +end diff --git a/.bundle/gems/coderay-1.1.0/lib/coderay/tokens_proxy.rb b/.bundle/gems/coderay-1.1.0/lib/coderay/tokens_proxy.rb new file mode 100644 index 0000000..31ff39b --- /dev/null +++ b/.bundle/gems/coderay-1.1.0/lib/coderay/tokens_proxy.rb @@ -0,0 +1,55 @@ +module CodeRay + + # The result of a scan operation is a TokensProxy, but should act like Tokens. + # + # This proxy makes it possible to use the classic CodeRay.scan.encode API + # while still providing the benefits of direct streaming. + class TokensProxy + + attr_accessor :input, :lang, :options, :block + + # Create a new TokensProxy with the arguments of CodeRay.scan. + def initialize input, lang, options = {}, block = nil + @input = input + @lang = lang + @options = options + @block = block + end + + # Call CodeRay.encode if +encoder+ is a Symbol; + # otherwise, convert the receiver to tokens and call encoder.encode_tokens. + def encode encoder, options = {} + if encoder.respond_to? :to_sym + CodeRay.encode(input, lang, encoder, options) + else + encoder.encode_tokens tokens, options + end + end + + # Tries to call encode; + # delegates to tokens otherwise. + def method_missing method, *args, &blk + encode method.to_sym, *args + rescue PluginHost::PluginNotFound + tokens.send(method, *args, &blk) + end + + # The (cached) result of the tokenized input; a Tokens instance. + def tokens + @tokens ||= scanner.tokenize(input) + end + + # A (cached) scanner instance to use for the scan task. + def scanner + @scanner ||= CodeRay.scanner(lang, options, &block) + end + + # Overwrite Struct#each. + def each *args, &blk + tokens.each(*args, &blk) + self + end + + end + +end diff --git a/.bundle/gems/coderay-1.1.0/lib/coderay/version.rb b/.bundle/gems/coderay-1.1.0/lib/coderay/version.rb new file mode 100644 index 0000000..4b4f085 --- /dev/null +++ b/.bundle/gems/coderay-1.1.0/lib/coderay/version.rb @@ -0,0 +1,3 @@ +module CodeRay + VERSION = '1.1.0' +end diff --git a/.bundle/gems/coderay-1.1.0/test/functional/basic.rb b/.bundle/gems/coderay-1.1.0/test/functional/basic.rb new file mode 100755 index 0000000..752d4ba --- /dev/null +++ b/.bundle/gems/coderay-1.1.0/test/functional/basic.rb @@ -0,0 +1,318 @@ +# encoding: utf-8 +require 'test/unit' +require File.expand_path('../../lib/assert_warning', __FILE__) + +$:.unshift File.expand_path('../../../lib', __FILE__) +require 'coderay' + +class BasicTest < Test::Unit::TestCase + + def test_version + assert_nothing_raised do + assert_match(/\A\d\.\d\.\d?\z/, CodeRay::VERSION) + end + end + + def with_empty_load_path + old_load_path = $:.dup + $:.clear + yield + ensure + $:.replace old_load_path + end + + def test_autoload + with_empty_load_path do + assert_nothing_raised do + CodeRay::Scanners::Java::BuiltinTypes + end + end + end + + RUBY_TEST_CODE = 'puts "Hello, World!"' + + RUBY_TEST_TOKENS = [ + ['puts', :ident], + [' ', :space], + [:begin_group, :string], + ['"', :delimiter], + ['Hello, World!', :content], + ['"', :delimiter], + [:end_group, :string] + ].flatten + def test_simple_scan + assert_nothing_raised do + assert_equal RUBY_TEST_TOKENS, CodeRay.scan(RUBY_TEST_CODE, :ruby).tokens + end + end + + RUBY_TEST_HTML = 'puts "' + + 'Hello, World!"' + def test_simple_highlight + assert_nothing_raised do + assert_equal RUBY_TEST_HTML, CodeRay.scan(RUBY_TEST_CODE, :ruby).html + end + end + + def test_scan_file + CodeRay.scan_file __FILE__ + end + + def test_encode + assert_equal 1, CodeRay.encode('test', :python, :count) + end + + def test_encode_tokens + assert_equal 1, CodeRay.encode_tokens(CodeRay::Tokens['test', :string], :count) + end + + def test_encode_file + assert_equal File.read(__FILE__), CodeRay.encode_file(__FILE__, :text) + end + + def test_highlight + assert_match '
test', CodeRay.highlight('test', :python) + end + + def test_highlight_file + assert_match "require 'test/unit'\n", CodeRay.highlight_file(__FILE__) + end + + def test_duo + assert_equal(RUBY_TEST_CODE, + CodeRay::Duo[:plain, :text].highlight(RUBY_TEST_CODE)) + assert_equal(RUBY_TEST_CODE, + CodeRay::Duo[:plain => :text].highlight(RUBY_TEST_CODE)) + end + + def test_duo_stream + assert_equal(RUBY_TEST_CODE, + CodeRay::Duo[:plain, :text].highlight(RUBY_TEST_CODE, :stream => true)) + end + + def test_comment_filter + assert_equal <<-EXPECTED, CodeRay.scan(<<-INPUT, :ruby).comment_filter.text +#!/usr/bin/env ruby + +code + +more code + EXPECTED +#!/usr/bin/env ruby +=begin +A multi-line comment. +=end +code +# A single-line comment. +more code # and another comment, in-line. + INPUT + end + + def test_lines_of_code + assert_equal 2, CodeRay.scan(<<-INPUT, :ruby).lines_of_code +#!/usr/bin/env ruby +=begin +A multi-line comment. +=end +code +# A single-line comment. +more code # and another comment, in-line. + INPUT + rHTML = <<-RHTML + + + + + +
<%= flash[:notice] %>
+ +puts "Hello, world!"
1 +2 +3 + |
+ 5.times do + puts 'Hello, world!' +end |
+
1 + |
+ puts "Hello, world!" |
+
{ "just": "an", "example": 42 }
puts "Hello, world!"
puts "Hello, World!"
", + RedCloth.new('@[ruby]puts "Hello, World!"@').to_html + assert_equal <<-BLOCKCODE.chomp, +puts "Hello, World!"
puts \"Hello, World!\"
puts \"Hello, World!\"
+ BLOCKCODE
+ RedCloth.new('bc. puts "Hello, World!"').to_html
+ end
+
+ def test_for_redcloth_style
+ require 'coderay/for_redcloth'
+ assert_equal <<-BLOCKCODE.chomp,
+puts \"Hello, World!\"
+ BLOCKCODE
+ RedCloth.new('bc{color: red}. puts "Hello, World!"').to_html
+ end
+
+ def test_for_redcloth_escapes
+ require 'coderay/for_redcloth'
+ assert_equal '>
', + RedCloth.new('@[ruby]>@').to_html + assert_equal <<-BLOCKCODE.chomp, +&
#include <test.h>
", + RedCloth.new('@[c]#include[project]_dff.skjd
_dff.skjd
", + RedCloth.new('@[ruby]_dff.skjd@').to_html + assert_equal <<-BLOCKCODE.chomp, RedCloth.new('bc. [project]_dff.skjd').to_html +[project]_dff.skjd
+ BLOCKCODE
+ end
+
+end if defined? RedCloth
\ No newline at end of file
diff --git a/.bundle/gems/coderay-1.1.0/test/functional/suite.rb b/.bundle/gems/coderay-1.1.0/test/functional/suite.rb
new file mode 100755
index 0000000..ec23eec
--- /dev/null
+++ b/.bundle/gems/coderay-1.1.0/test/functional/suite.rb
@@ -0,0 +1,15 @@
+require 'test/unit'
+
+$VERBOSE = $CODERAY_DEBUG = true
+$:.unshift File.expand_path('../../../lib', __FILE__)
+require 'coderay'
+
+mydir = File.dirname(__FILE__)
+suite = Dir[File.join(mydir, '*.rb')].
+ map { |tc| File.basename(tc).sub(/\.rb$/, '') } - %w'suite for_redcloth'
+
+puts "Running basic CodeRay #{CodeRay::VERSION} tests: #{suite.join(', ')}"
+
+for test_case in suite
+ load File.join(mydir, test_case + '.rb')
+end
diff --git a/.bundle/gems/diff-lcs-1.2.5/.autotest b/.bundle/gems/diff-lcs-1.2.5/.autotest
new file mode 100644
index 0000000..1236395
--- /dev/null
+++ b/.bundle/gems/diff-lcs-1.2.5/.autotest
@@ -0,0 +1,3 @@
+require 'rubygems'
+
+# vim: syntax=ruby
diff --git a/.bundle/gems/diff-lcs-1.2.5/.gemtest b/.bundle/gems/diff-lcs-1.2.5/.gemtest
new file mode 100644
index 0000000..e69de29
diff --git a/.bundle/gems/diff-lcs-1.2.5/.hoerc b/.bundle/gems/diff-lcs-1.2.5/.hoerc
new file mode 100644
index 0000000..0a13543
--- /dev/null
+++ b/.bundle/gems/diff-lcs-1.2.5/.hoerc
@@ -0,0 +1,2 @@
+---
+exclude: !ruby/regexp /(tmp|swp)$|CVS|TAGS|\.(svn|git|hg|DS_Store|idea)|Gemfile\.lock|research\/|\.gemspec$/
diff --git a/.bundle/gems/diff-lcs-1.2.5/.rspec b/.bundle/gems/diff-lcs-1.2.5/.rspec
new file mode 100644
index 0000000..7438fbe
--- /dev/null
+++ b/.bundle/gems/diff-lcs-1.2.5/.rspec
@@ -0,0 +1,2 @@
+--colour
+--format documentation
diff --git a/.bundle/gems/diff-lcs-1.2.5/.travis.yml b/.bundle/gems/diff-lcs-1.2.5/.travis.yml
new file mode 100644
index 0000000..903cddf
--- /dev/null
+++ b/.bundle/gems/diff-lcs-1.2.5/.travis.yml
@@ -0,0 +1,22 @@
+---
+after_script:
+- rake travis:after -t
+before_script:
+- gem install hoe-travis --no-rdoc --no-ri
+- rake travis:before -t
+language: ruby
+notifications:
+ email: true
+rvm:
+ - 2.0.0
+ - 1.9.3
+ - 1.9.2
+ - ruby-head
+ - 1.8.7
+ - jruby-19mode
+ - jruby-head
+ - jruby-18mode
+ - rbx-19mode
+ - rbx-18mode
+ - ree
+script: rake travis
diff --git a/.bundle/gems/diff-lcs-1.2.5/Contributing.rdoc b/.bundle/gems/diff-lcs-1.2.5/Contributing.rdoc
new file mode 100644
index 0000000..a0f37de
--- /dev/null
+++ b/.bundle/gems/diff-lcs-1.2.5/Contributing.rdoc
@@ -0,0 +1,64 @@
+== Contributing
+
+I value any contribution to Diff::LCS you can provide: a bug report, a feature
+request, or code contributions.
+
+Code contributions to Diff::LCS are especially #{element}\n| + end + private :htmlize + + # This will be called with both lines are the same + def match(event) + @output << htmlize(event.old_element, :match_class) + end + + # This will be called when there is a line in A that isn't in B + def discard_a(event) + @output << htmlize(event.old_element, :only_a_class) + end + + # This will be called when there is a line in B that isn't in A + def discard_b(event) + @output << htmlize(event.new_element, :only_b_class) + end + end + + DEFAULT_OPTIONS = { + :expand_tabs => nil, + :output => nil, + :css => nil, + :title => nil, + } + + DEFAULT_CSS = <<-CSS +body { margin: 0; } +.diff +{ + border: 1px solid black; + margin: 1em 2em; +} +p +{ + margin-left: 2em; +} +pre +{ + padding-left: 1em; + margin: 0; + font-family: Inconsolata, Consolas, Lucida, Courier, monospaced; + white-space: pre; +} +.match { } +.only_a +{ + background-color: #fdd; + color: red; + text-decoration: line-through; +} +.only_b +{ + background-color: #ddf; + color: blue; + border-left: 3px solid blue +} +h1 { margin-left: 2em; } + CSS + + def initialize(left, right, options = nil) + @left = left + @right = right + @options = options + + @options = DEFAULT_OPTIONS.dup if @options.nil? + end + + def verify_options + @options[:expand_tabs] ||= 4 + @options[:expand_tabs] = 4 if @options[:expand_tabs] < 0 + + @options[:output] ||= $stdout + + @options[:css] ||= DEFAULT_CSS.dup + + @options[:title] ||= "diff" + end + private :verify_options + + attr_reader :options + + def run + verify_options + + if @options[:expand_tabs] > 0 && self.class.can_expand_tabs + formatter = Text::Format.new + formatter.tabstop = @options[:expand_tabs] + + @left = left.map { |line| formatter.expand(line.chomp) } + @right = right.map { |line| formatter.expand(line.chomp) } + end + + @left.map! { |line| CGI.escapeHTML(line.chomp) } + @right.map! { |line| CGI.escapeHTML(line.chomp) } + + @options[:output] << <<-OUTPUT + + +
Legend: Only in Old + Only in New
+(?:\s*\n)?(.*?)\s*<\/code>/m) { CodeRay.scan($1, :ruby).term }.
+ gsub(/(?:\s*\n)?(.*?)\s*<\/em>/m) { "\e[1m#{$1}\e[0m" }.
+ gsub(/(?:\s*\n)?(.*?)\s*<\/i>/m) { "\e[1m#{$1}\e[0m" }.
+ gsub(/\B\+(\w+?)\+\B/) { "\e[32m#{$1}\e[0m" }.
+ gsub(/((?:^[ \t]+.+(?:\n+|\Z))+)/) { CodeRay.scan($1, :ruby).term }.
+ gsub(/`(?:\s*\n)?([^\e]*?)\s*`/) { "`#{CodeRay.scan($1, :ruby).term}`" }
+ end
+
+ def process_yardoc_tag(comment, tag)
+ in_tag_block = nil
+ comment.lines.map do |v|
+ if in_tag_block && v !~ /^\S/
+ Pry::Helpers::Text.strip_color Pry::Helpers::Text.strip_color(v)
+ elsif in_tag_block
+ in_tag_block = false
+ v
+ else
+ in_tag_block = true if v =~ /^@#{tag}/
+ v
+ end
+ end.join
+ end
+
+ def process_yardoc(comment)
+ yard_tags = ["param", "return", "option", "yield", "attr", "attr_reader", "attr_writer",
+ "deprecate", "example", "raise"]
+ (yard_tags - ["example"]).inject(comment) { |a, v| process_yardoc_tag(a, v) }.
+ gsub(/^@(#{yard_tags.join("|")})/) { "\e[33m#{$1}\e[0m" }
+ end
+
+ def process_comment_markup(comment)
+ process_yardoc process_rdoc(comment)
+ end
+
+ # @param [String] code
+ # @return [String]
+ def strip_comments_from_c_code(code)
+ code.sub(/\A\s*\/\*.*?\*\/\s*/m, '')
+ end
+
+ # Given a string that makes up a comment in a source-code file parse out the content
+ # that the user is intended to read. (i.e. without leading indentation, #-characters
+ # or shebangs)
+ #
+ # @param [String] comment
+ # @return [String]
+ def get_comment_content(comment)
+ comment = comment.dup
+ # Remove #!/usr/bin/ruby
+ comment.gsub!(/\A\#!.*$/, '')
+ # Remove leading empty comment lines
+ comment.gsub!(/\A\#+?$/, '')
+ comment.gsub!(/^\s*#/, '')
+ strip_leading_whitespace(comment)
+ end
+
+ # @param [String] text
+ # @return [String]
+ def strip_leading_whitespace(text)
+ Pry::Helpers::CommandHelpers.unindent(text)
+ end
+ end
+ end
+end
diff --git a/.bundle/gems/pry-0.10.1/lib/pry/helpers/options_helpers.rb b/.bundle/gems/pry-0.10.1/lib/pry/helpers/options_helpers.rb
new file mode 100644
index 0000000..e566d3b
--- /dev/null
+++ b/.bundle/gems/pry-0.10.1/lib/pry/helpers/options_helpers.rb
@@ -0,0 +1,27 @@
+class Pry
+ module Helpers
+ module OptionsHelpers
+ module_function
+
+ # Add method options to the Slop instance
+ def method_options(opt)
+ @method_target = target
+ opt.on :M, "instance-methods", "Operate on instance methods."
+ opt.on :m, :methods, "Operate on methods."
+ opt.on :s, :super, "Select the 'super' method. Can be repeated to traverse the ancestors.", :as => :count
+ opt.on :c, :context, "Select object context to run under.", :argument => true do |context|
+ @method_target = Pry.binding_for(target.eval(context))
+ end
+ end
+
+ # Get the method object parsed by the slop instance
+ def method_object
+ @method_object ||= get_method_or_raise(args.empty? ? nil : args.join(" "), @method_target,
+ :super => opts[:super],
+ :instance => opts.present?(:'instance-methods') && !opts.present?(:'methods'),
+ :methods => opts.present?(:'methods') && !opts.present?(:'instance-methods')
+ )
+ end
+ end
+ end
+end
diff --git a/.bundle/gems/pry-0.10.1/lib/pry/helpers/table.rb b/.bundle/gems/pry-0.10.1/lib/pry/helpers/table.rb
new file mode 100644
index 0000000..56e7e59
--- /dev/null
+++ b/.bundle/gems/pry-0.10.1/lib/pry/helpers/table.rb
@@ -0,0 +1,109 @@
+class Pry
+ module Helpers
+ def self.tablify_or_one_line(heading, things)
+ plain_heading = Pry::Helpers::Text.strip_color(heading)
+ attempt = Table.new(things, :column_count => things.size)
+ if attempt.fits_on_line?(Terminal.width! - plain_heading.size - 2)
+ "#{heading}: #{attempt}\n"
+ else
+ "#{heading}: \n#{tablify_to_screen_width(things, :indent => ' ')}\n"
+ end
+ end
+
+ def self.tablify_to_screen_width(things, options = {})
+ things = things.compact
+ if indent = options[:indent]
+ usable_width = Terminal.width! - indent.size
+ tablify(things, usable_width).to_s.gsub(/^/, indent)
+ else
+ tablify(things, Terminal.width!).to_s
+ end
+ end
+
+ def self.tablify(things, line_length)
+ table = Table.new(things, :column_count => things.size)
+ table.column_count -= 1 until 1 == table.column_count or
+ table.fits_on_line?(line_length)
+ table
+ end
+
+ class Table
+ attr_reader :items, :column_count
+ def initialize items, args = {}
+ @column_count = args[:column_count]
+ self.items = items
+ end
+
+ def to_s
+ rows_to_s.join("\n")
+ end
+
+ def rows_to_s style = :color_on
+ widths = columns.map{|e| _max_width(e)}
+ @rows_without_colors.map do |r|
+ padded = []
+ r.each_with_index do |e,i|
+ next unless e
+ item = e.ljust(widths[i])
+ item.sub! e, _recall_color_for(e) if :color_on == style
+ padded << item
+ end
+ padded.join(Pry.config.ls.separator)
+ end
+ end
+
+ def items= items
+ @items = items
+ _rebuild_colorless_cache
+ _recolumn
+ items
+ end
+
+ def column_count= n
+ @column_count = n
+ _recolumn
+ end
+
+ def fits_on_line? line_length
+ _max_width(rows_to_s :no_color) <= line_length
+ end
+
+ def columns
+ @rows_without_colors.transpose
+ end
+
+ def ==(other); items == other.to_a end
+ def to_a; items.to_a end
+
+ private
+ def _max_width(things)
+ things.compact.map(&:size).max || 0
+ end
+
+ def _rebuild_colorless_cache
+ @colorless_cache = {}
+ @plain_items = []
+ items.map do |e|
+ plain = Pry::Helpers::Text.strip_color(e)
+ @colorless_cache[plain] = e
+ @plain_items << plain
+ end
+ end
+
+ def _recolumn
+ @rows_without_colors = []
+ return if items.size.zero?
+ row_count = (items.size.to_f/column_count).ceil
+ row_count.times do |i|
+ row_indices = (0...column_count).map{|e| row_count*e+i}
+ @rows_without_colors << row_indices.map{|e| @plain_items[e]}
+ end
+ end
+
+ def _recall_color_for thing
+ @colorless_cache[thing]
+ end
+ end
+
+ end
+end
diff --git a/.bundle/gems/pry-0.10.1/lib/pry/helpers/text.rb b/.bundle/gems/pry-0.10.1/lib/pry/helpers/text.rb
new file mode 100644
index 0000000..13867cf
--- /dev/null
+++ b/.bundle/gems/pry-0.10.1/lib/pry/helpers/text.rb
@@ -0,0 +1,107 @@
+class Pry
+ module Helpers
+
+ # The methods defined on {Text} are available to custom commands via {Pry::Command#text}.
+ module Text
+
+ COLORS =
+ {
+ "black" => 0,
+ "red" => 1,
+ "green" => 2,
+ "yellow" => 3,
+ "blue" => 4,
+ "purple" => 5,
+ "magenta" => 5,
+ "cyan" => 6,
+ "white" => 7
+ }
+
+ class << self
+
+ COLORS.each_pair do |color, value|
+ define_method color do |text|
+ "\033[0;#{30+value}m#{text}\033[0m"
+ end
+
+ define_method "bright_#{color}" do |text|
+ "\033[1;#{30+value}m#{text}\033[0m"
+ end
+ end
+
+ # Remove any color codes from _text_.
+ #
+ # @param [String, #to_s] text
+ # @return [String] _text_ stripped of any color codes.
+ def strip_color(text)
+ text.to_s.gsub(/\e\[.*?(\d)+m/ , '')
+ end
+
+ # Returns _text_ as bold text for use on a terminal.
+ #
+ # @param [String, #to_s] text
+ # @return [String] _text_
+ def bold(text)
+ "\e[1m#{text}\e[0m"
+ end
+
+ # Returns `text` in the default foreground colour.
+ # Use this instead of "black" or "white" when you mean absence of colour.
+ #
+ # @param [String, #to_s] text
+ # @return [String]
+ def default(text)
+ text.to_s
+ end
+ alias_method :bright_default, :bold
+
+ # Executes the block with `Pry.config.color` set to false.
+ # @yield
+ # @return [void]
+ def no_color(&block)
+ boolean = Pry.config.color
+ Pry.config.color = false
+ yield
+ ensure
+ Pry.config.color = boolean
+ end
+
+ # Executes the block with `Pry.config.pager` set to false.
+ # @yield
+ # @return [void]
+ def no_pager(&block)
+ boolean = Pry.config.pager
+ Pry.config.pager = false
+ yield
+ ensure
+ Pry.config.pager = boolean
+ end
+
+ # Returns _text_ in a numbered list, beginning at _offset_.
+ #
+ # @param [#each_line] text
+ # @param [Fixnum] offset
+ # @return [String]
+ def with_line_numbers(text, offset, color=:blue)
+ lines = text.each_line.to_a
+ max_width = (offset + lines.count).to_s.length
+ lines.each_with_index.map do |line, index|
+ adjusted_index = (index + offset).to_s.rjust(max_width)
+ "#{self.send(color, adjusted_index)}: #{line}"
+ end.join
+ end
+
+ # Returns _text_ indented by _chars_ spaces.
+ #
+ # @param [String] text
+ # @param [Fixnum] chars
+ def indent(text, chars)
+ text.lines.map { |l| "#{' ' * chars}#{l}" }.join
+ end
+ end
+
+ end
+
+ end
+end
+
diff --git a/.bundle/gems/pry-0.10.1/lib/pry/history.rb b/.bundle/gems/pry-0.10.1/lib/pry/history.rb
new file mode 100644
index 0000000..81b7417
--- /dev/null
+++ b/.bundle/gems/pry-0.10.1/lib/pry/history.rb
@@ -0,0 +1,127 @@
+class Pry
+ # The History class is responsible for maintaining the user's input history,
+ # both internally and within Readline.
+ class History
+ attr_accessor :loader, :saver, :pusher, :clearer
+
+ # @return [Fixnum] Number of lines in history when Pry first loaded.
+ attr_reader :original_lines
+
+ def initialize(options={})
+ @history = []
+ @original_lines = 0
+ @file_path = options[:file_path]
+ restore_default_behavior
+ end
+
+ # Assign the default methods for loading, saving, pushing, and clearing.
+ def restore_default_behavior
+ Pry.config.input # force Readline to load if applicable
+
+ @loader = method(:read_from_file)
+ @saver = method(:save_to_file)
+
+ if defined?(Readline)
+ @pusher = method(:push_to_readline)
+ @clearer = method(:clear_readline)
+ else
+ @pusher = proc { }
+ @clearer = proc { }
+ end
+ end
+
+ # Load the input history using `History.loader`.
+ # @return [Integer] The number of lines loaded
+ def load
+ @loader.call do |line|
+ @pusher.call(line.chomp)
+ @history << line.chomp
+ @original_lines += 1
+ end
+ end
+
+ # Add a line to the input history, ignoring blank and duplicate lines.
+ # @param [String] line
+ # @return [String] The same line that was passed in
+ def push(line)
+ unless line.empty? || (@history.last && line == @history.last)
+ @pusher.call(line)
+ @history << line
+ @saver.call(line) if Pry.config.history.should_save
+ end
+ line
+ end
+ alias << push
+
+ # Clear this session's history. This won't affect the contents of the
+ # history file.
+ def clear
+ @clearer.call
+ @history = []
+ end
+
+ # @return [Fixnum] The number of lines in history.
+ def history_line_count
+ @history.count
+ end
+
+ # @return [Fixnum] The number of lines in history from just this session.
+ def session_line_count
+ @history.count - @original_lines
+ end
+
+ # Return an Array containing all stored history.
+ # @return [Array] An Array containing all lines of history loaded
+ # or entered by the user in the current session.
+ def to_a
+ @history.dup
+ end
+
+ private
+
+ # The default loader. Yields lines from `Pry.history.config.file`.
+ def read_from_file
+ path = history_file_path
+
+ if File.exists?(path)
+ File.foreach(path) { |line| yield(line) }
+ end
+ rescue => error
+ warn "History file not loaded: #{error.message}"
+ end
+
+ # The default pusher. Appends the given line to Readline::HISTORY.
+ # @param [String] line
+ def push_to_readline(line)
+ Readline::HISTORY << line
+ end
+
+ # The default clearer. Clears Readline::HISTORY.
+ def clear_readline
+ Readline::HISTORY.shift until Readline::HISTORY.empty?
+ end
+
+ # The default saver. Appends the given line to `Pry.history.config.file`.
+ def save_to_file(line)
+ history_file.puts line if history_file
+ end
+
+ # The history file, opened for appending.
+ def history_file
+ if defined?(@history_file)
+ @history_file
+ else
+ @history_file = File.open(history_file_path, 'a', 0600).tap do |file|
+ file.sync = true
+ end
+ end
+ rescue Errno::EACCES
+ warn 'History not saved; unable to open your history file for writing.'
+ @history_file = false
+ end
+
+ def history_file_path
+ File.expand_path(@file_path || Pry.config.history.file)
+ end
+ end
+end
diff --git a/.bundle/gems/pry-0.10.1/lib/pry/history_array.rb b/.bundle/gems/pry-0.10.1/lib/pry/history_array.rb
new file mode 100644
index 0000000..60e41bc
--- /dev/null
+++ b/.bundle/gems/pry-0.10.1/lib/pry/history_array.rb
@@ -0,0 +1,121 @@
+class Pry
+ # A history array is an array to which you can only add elements. Older
+ # entries are removed progressively, so that the array never contains more than
+ # N elements.
+ #
+ # History arrays are used by Pry to store the output of the last commands.
+ #
+ # @example
+ # ary = Pry::HistoryArray.new 10
+ # ary << 1 << 2 << 3
+ # ary[0] # => 1
+ # ary[1] # => 2
+ # 10.times { |n| ary << n }
+ # ary[0] # => nil
+ # ary[-1] # => 9
+ class HistoryArray
+ include Enumerable
+
+ # @param [Integer] size Maximum amount of objects in the array
+ def initialize(size)
+ @max_size = size
+
+ @hash = {}
+ @count = 0
+ end
+
+ # Pushes an object at the end of the array
+ # @param [Object] value Object to be added
+ def <<(value)
+ @hash[@count] = value
+
+ if @hash.size > max_size
+ @hash.delete(@count - max_size)
+ end
+
+ @count += 1
+
+ self
+ end
+
+ # @overload [](index)
+ # @param [Integer] index Index of the item to access.
+ # @return [Object, nil] Item at that index or nil if it has been removed.
+ # @overload [](index, size)
+ # @param [Integer] index Index of the first item to access.
+ # @param [Integer] size Amount of items to access
+ # @return [Array, nil] The selected items. Nil if index is greater than
+ # the size of the array.
+ # @overload [](range)
+ # @param [Range] range Range of indices to access.
+ # @return [Array, nil] The selected items. Nil if index is greater than
+ # the size of the array.
+ def [](index_or_range, size = nil)
+ if index_or_range.is_a? Integer
+ index = convert_index(index_or_range)
+
+ if size
+ end_index = index + size
+ index > @count ? nil : (index...[end_index, @count].min).map do |n|
+ @hash[n]
+ end
+ else
+ @hash[index]
+ end
+ else
+ range = convert_range(index_or_range)
+ range.begin > @count ? nil : range.map { |n| @hash[n] }
+ end
+ end
+
+ # @return [Integer] Amount of objects in the array
+ def size
+ @count
+ end
+ alias count size
+ alias length size
+
+ def empty?
+ size == 0
+ end
+
+ def each
+ ((@count - size)...@count).each do |n|
+ yield @hash[n]
+ end
+ end
+
+ def to_a
+ ((@count - size)...@count).map { |n| @hash[n] }
+ end
+
+ # Returns [Hash] copy of the internal @hash history
+ def to_h
+ @hash.dup
+ end
+
+ def pop!
+ @hash.delete @count - 1
+ @count -= 1
+ end
+
+ def inspect
+ "#<#{self.class} size=#{size} first=#{@count - size} max_size=#{max_size}>"
+ end
+
+ # @return [Integer] Maximum amount of objects in the array
+ attr_reader :max_size
+
+ private
+ def convert_index(n)
+ n >= 0 ? n : @count + n
+ end
+
+ def convert_range(range)
+ end_index = convert_index(range.end)
+ end_index += 1 unless range.exclude_end?
+
+ Range.new(convert_index(range.begin), [end_index, @count].min, true)
+ end
+ end
+end
diff --git a/.bundle/gems/pry-0.10.1/lib/pry/hooks.rb b/.bundle/gems/pry-0.10.1/lib/pry/hooks.rb
new file mode 100644
index 0000000..48291ee
--- /dev/null
+++ b/.bundle/gems/pry-0.10.1/lib/pry/hooks.rb
@@ -0,0 +1,230 @@
+class Pry
+
+ # Implements a hooks system for Pry. A hook is a callable that is
+ # associated with an event. A number of events are currently
+ # provided by Pry, these include: `:when_started`, `:before_session`, `:after_session`.
+ # A hook must have a name, and is connected with an event by the
+ # `Pry::Hooks#add_hook` method.
+ # @example Adding a hook for the `:before_session` event.
+ # Pry.config.hooks.add_hook(:before_session, :say_hi) do
+ # puts "hello"
+ # end
+ class Hooks
+
+ # Converts a hash to a `Pry::Hooks` instance. All hooks defined
+ # this way are anonymous. This functionality is primarily to
+ # provide backwards-compatibility with the old hash-based hook
+ # system in Pry versions < 0.9.8
+ # @param [Hash] hash The hash to convert to `Pry::Hooks`.
+ # @return [Pry::Hooks] The resulting `Pry::Hooks` instance.
+ def self.from_hash(hash)
+ return hash if hash.instance_of?(self)
+ instance = new
+ hash.each do |k, v|
+ instance.add_hook(k, nil, v)
+ end
+ instance
+ end
+
+ def initialize
+ @hooks = {}
+ end
+
+ # Ensure that duplicates have their @hooks object
+ def initialize_copy(orig)
+ hooks_dup = @hooks.dup
+ @hooks.each do |k, v|
+ hooks_dup[k] = v.dup
+ end
+
+ @hooks = hooks_dup
+ end
+
+ def hooks
+ @hooks
+ end
+ protected :hooks
+
+ def errors
+ @errors ||= []
+ end
+
+ # Destructively merge the contents of two `Pry:Hooks` instances.
+ # @param [Pry::Hooks] other The `Pry::Hooks` instance to merge
+ # @return [Pry:Hooks] Returns the receiver.
+ # @example
+ # hooks = Pry::Hooks.new.add_hook(:before_session, :say_hi) { puts "hi!" }
+ # Pry::Hooks.new.merge!(hooks)
+ def merge!(other)
+ @hooks.merge!(other.dup.hooks) do |key, v1, v2|
+ merge_arrays(v1, v2)
+ end
+
+ self
+ end
+
+ def merge_arrays(array1, array2)
+ uniq_keeping_last(array1 + array2, &:first)
+ end
+ private :merge_arrays
+
+ def uniq_keeping_last(input, &block)
+ hash, output = {}, []
+ input.reverse.each{ |i| hash[block[i]] ||= (output.unshift i) }
+ output
+ end
+ private :uniq_keeping_last
+
+ # Return a new `Pry::Hooks` instance containing a merge of the contents of two `Pry:Hooks` instances,
+ # @param [Pry::Hooks] other The `Pry::Hooks` instance to merge
+ # @return [Pry::Hooks] The new hash.
+ # @example
+ # hooks = Pry::Hooks.new.add_hook(:before_session, :say_hi) { puts "hi!" }
+ # Pry::Hooks.new.merge(hooks)
+ def merge(other)
+ self.dup.tap do |v|
+ v.merge!(other)
+ end
+ end
+
+ # Add a new hook to be executed for the `name` even.
+ # @param [Symbol] event_name The name of the event.
+ # @param [Symbol] hook_name The name of the hook.
+ # @param [#call] callable The callable.
+ # @yield The block to use as the callable (if `callable` parameter not provided)
+ # @return [Pry:Hooks] Returns the receiver.
+ # @example
+ # Pry::Hooks.new.add_hook(:before_session, :say_hi) { puts "hi!" }
+ def add_hook(event_name, hook_name, callable=nil, &block)
+ @hooks[event_name] ||= []
+
+ # do not allow duplicates, but allow multiple `nil` hooks
+ # (anonymous hooks)
+ if hook_exists?(event_name, hook_name) && !hook_name.nil?
+ raise ArgumentError, "Hook with name '#{hook_name}' already defined!"
+ end
+
+ if !block && !callable
+ raise ArgumentError, "Must provide a block or callable."
+ end
+
+ # ensure we only have one anonymous hook
+ @hooks[event_name].delete_if { |h, k| h.nil? } if hook_name.nil?
+
+ if block
+ @hooks[event_name] << [hook_name, block]
+ elsif callable
+ @hooks[event_name] << [hook_name, callable]
+ end
+
+ self
+ end
+
+ # Execute the list of hooks for the `event_name` event.
+ # @param [Symbol] event_name The name of the event.
+ # @param [Array] args The arguments to pass to each hook function.
+ # @return [Object] The return value of the last executed hook.
+ # @example
+ # my_hooks = Pry::Hooks.new.add_hook(:before_session, :say_hi) { puts "hi!" }
+ # my_hooks.exec_hook(:before_session) #=> OUTPUT: "hi!"
+ def exec_hook(event_name, *args, &block)
+ @hooks[event_name] ||= []
+
+ @hooks[event_name].map do |hook_name, callable|
+ begin
+ callable.call(*args, &block)
+ rescue RescuableException => e
+ errors << e
+ e
+ end
+ end.last
+ end
+
+ # Return the number of hook functions registered for the `event_name` event.
+ # @param [Symbol] event_name The name of the event.
+ # @return [Fixnum] The number of hook functions for `event_name`.
+ # @example
+ # my_hooks = Pry::Hooks.new.add_hook(:before_session, :say_hi) { puts "hi!" }
+ # my_hooks.count(:before_session) #=> 1
+ def hook_count(event_name)
+ @hooks[event_name] ||= []
+ @hooks[event_name].size
+ end
+
+ # Return a specific hook for a given event.
+ # @param [Symbol] event_name The name of the event.
+ # @param [Symbol] hook_name The name of the hook
+ # @return [#call] The requested hook.
+ # @example
+ # my_hooks = Pry::Hooks.new.add_hook(:before_session, :say_hi) { puts "hi!" }
+ # my_hooks.get_hook(:before_session, :say_hi).call #=> "hi!"
+ def get_hook(event_name, hook_name)
+ @hooks[event_name] ||= []
+ hook = @hooks[event_name].find { |current_hook_name, callable| current_hook_name == hook_name }
+ hook.last if hook
+ end
+
+ # Return the hash of hook names / hook functions for a
+ # given event. (Note that modifying the returned hash does not
+ # alter the hooks, use add_hook/delete_hook for that).
+ # @param [Symbol] event_name The name of the event.
+ # @return [Hash] The hash of hook names / hook functions.
+ # @example
+ # my_hooks = Pry::Hooks.new.add_hook(:before_session, :say_hi) { puts "hi!" }
+ # my_hooks.get_hooks(:before_session) #=> {:say_hi=>#}
+ def get_hooks(event_name)
+ @hooks[event_name] ||= []
+ Hash[@hooks[event_name]]
+ end
+
+ # Delete a hook for an event.
+ # @param [Symbol] event_name The name of the event.
+ # @param [Symbol] hook_name The name of the hook.
+ # to delete.
+ # @return [#call] The deleted hook.
+ # @example
+ # my_hooks = Pry::Hooks.new.add_hook(:before_session, :say_hi) { puts "hi!" }
+ # my_hooks.delete_hook(:before_session, :say_hi)
+ def delete_hook(event_name, hook_name)
+ @hooks[event_name] ||= []
+ deleted_callable = nil
+
+ @hooks[event_name].delete_if do |current_hook_name, callable|
+ if current_hook_name == hook_name
+ deleted_callable = callable
+ true
+ else
+ false
+ end
+ end
+ deleted_callable
+ end
+
+ # Clear all hooks functions for a given event.
+ # @param [String] event_name The name of the event.
+ # @example
+ # my_hooks = Pry::Hooks.new.add_hook(:before_session, :say_hi) { puts "hi!" }
+ # my_hooks.delete_hook(:before_session)
+ def delete_hooks(event_name)
+ @hooks[event_name] = []
+ end
+
+ alias_method :clear, :delete_hooks
+
+ # Remove all events and hooks, clearing out the Pry::Hooks
+ # instance completely.
+ # @example
+ # my_hooks = Pry::Hooks.new.add_hook(:before_session, :say_hi) { puts "hi!" }
+ # my_hooks.clear_all
+ def clear_all
+ @hooks = {}
+ end
+
+ # @param [Symbol] event_name Name of the event.
+ # @param [Symbol] hook_name Name of the hook.
+ # @return [Boolean] Whether the hook by the name `hook_name`
+ def hook_exists?(event_name, hook_name)
+ !!(@hooks[event_name] && @hooks[event_name].find { |name, _| name == hook_name })
+ end
+ end
+end
diff --git a/.bundle/gems/pry-0.10.1/lib/pry/indent.rb b/.bundle/gems/pry-0.10.1/lib/pry/indent.rb
new file mode 100644
index 0000000..72fbf69
--- /dev/null
+++ b/.bundle/gems/pry-0.10.1/lib/pry/indent.rb
@@ -0,0 +1,406 @@
+require 'coderay'
+
+class Pry
+ ##
+ # Pry::Indent is a class that can be used to indent a number of lines
+ # containing Ruby code similar as to how IRB does it (but better). The class
+ # works by tokenizing a string using CodeRay and then looping over those
+ # tokens. Based on the tokens in a line of code that line (or the next one)
+ # will be indented or un-indented by correctly.
+ #
+ class Indent
+ include Helpers::BaseHelpers
+
+ # Raised if {#module_nesting} would not work.
+ class UnparseableNestingError < StandardError; end
+
+ # @return [String] String containing the spaces to be inserted before the next line.
+ attr_reader :indent_level
+
+ # @return [Array] The stack of open tokens.
+ attr_reader :stack
+
+ # The amount of spaces to insert for each indent level.
+ SPACES = ' '
+
+ # Hash containing all the tokens that should increase the indentation
+ # level. The keys of this hash are open tokens, the values the matching
+ # tokens that should prevent a line from being indented if they appear on
+ # the same line.
+ OPEN_TOKENS = {
+ 'def' => 'end',
+ 'class' => 'end',
+ 'module' => 'end',
+ 'do' => 'end',
+ 'if' => 'end',
+ 'unless' => 'end',
+ 'while' => 'end',
+ 'until' => 'end',
+ 'for' => 'end',
+ 'case' => 'end',
+ 'begin' => 'end',
+ '[' => ']',
+ '{' => '}',
+ '(' => ')'
+ }
+
+ # Which tokens can either be open tokens, or appear as modifiers on
+ # a single-line.
+ SINGLELINE_TOKENS = %w(if while until unless rescue)
+
+ # Which tokens can be followed by an optional "do" keyword.
+ OPTIONAL_DO_TOKENS = %w(for while until)
+
+ # Collection of token types that should be ignored. Without this list
+ # keywords such as "class" inside strings would cause the code to be
+ # indented incorrectly.
+ #
+ # :pre_constant and :preserved_constant are the CodeRay 0.9.8 and 1.0.0
+ # classifications of "true", "false", and "nil".
+ IGNORE_TOKENS = [:space, :content, :string, :method, :ident,
+ :constant, :pre_constant, :predefined_constant]
+
+ # Tokens that indicate the end of a statement (i.e. that, if they appear
+ # directly before an "if" indicates that that if applies to the same line,
+ # not the next line)
+ #
+ # :reserved and :keywords are the CodeRay 0.9.8 and 1.0.0 respectively
+ # classifications of "super", "next", "return", etc.
+ STATEMENT_END_TOKENS = IGNORE_TOKENS + [:regexp, :integer, :float, :keyword,
+ :delimiter, :reserved]
+
+ # Collection of tokens that should appear dedented even though they
+ # don't affect the surrounding code.
+ MIDWAY_TOKENS = %w(when else elsif ensure rescue)
+
+ # Clean the indentation of a fragment of ruby.
+ #
+ # @param [String] str
+ # @return [String]
+ def self.indent(str)
+ new.indent(str)
+ end
+
+ # Get the module nesting at the given point in the given string.
+ #
+ # NOTE If the line specified contains a method definition, then the nesting
+ # at the start of the method definition is used. Otherwise the nesting from
+ # the end of the line is used.
+ #
+ # @param [String] str The ruby code to analyze
+ # @param [Fixnum] line_number The line number (starting from 1)
+ # @return [Array]
+ def self.nesting_at(str, line_number)
+ indent = new
+ lines = str.split("\n")
+ n = line_number - 1
+ to_indent = lines[0...n] << (lines[n] || "").split("def").first(1)
+ indent.indent(to_indent.join("\n") << "\n")
+ indent.module_nesting
+ end
+
+ def initialize
+ reset
+ end
+
+ # reset internal state
+ def reset
+ @stack = []
+ @indent_level = ''
+ @heredoc_queue = []
+ @close_heredocs = {}
+ @string_start = nil
+ @awaiting_class = false
+ @module_nesting = []
+ self
+ end
+
+ # Indents a string and returns it. This string can either be a single line
+ # or multiple ones.
+ #
+ # @example
+ # str = <]
+ def module_nesting
+ @module_nesting.map do |(kind, token)|
+ raise UnparseableNestingError, @module_nesting.inspect if token.nil?
+
+ "#{kind} #{token}"
+ end
+ end
+
+ # Return a string which, when printed, will rewrite the previous line with
+ # the correct indentation. Mostly useful for fixing 'end'.
+ #
+ # @param [String] prompt The user's prompt
+ # @param [String] code The code the user just typed in.
+ # @param [Fixnum] overhang (0) The number of chars to erase afterwards (i.e.,
+ # the difference in length between the old line and the new one).
+ # @return [String]
+ def correct_indentation(prompt, code, overhang=0)
+ prompt = prompt.delete("\001\002")
+ line_to_measure = Pry::Helpers::Text.strip_color(prompt) << code
+ whitespace = ' ' * overhang
+
+ _, cols = Terminal.screen_size
+
+ cols = cols.to_i
+ lines = (cols != 0 ? (line_to_measure.length / cols + 1) : 1).to_i
+
+ if Pry::Helpers::BaseHelpers.windows_ansi?
+ move_up = "\e[#{lines}F"
+ move_down = "\e[#{lines}E"
+ else
+ move_up = "\e[#{lines}A\e[0G"
+ move_down = "\e[#{lines}B\e[0G"
+ end
+
+ "#{move_up}#{prompt}#{colorize_code(code)}#{whitespace}#{move_down}"
+ end
+ end
+end
diff --git a/.bundle/gems/pry-0.10.1/lib/pry/input_completer.rb b/.bundle/gems/pry-0.10.1/lib/pry/input_completer.rb
new file mode 100644
index 0000000..363baa4
--- /dev/null
+++ b/.bundle/gems/pry-0.10.1/lib/pry/input_completer.rb
@@ -0,0 +1,242 @@
+# taken from irb
+# Implements tab completion for Readline in Pry
+class Pry::InputCompleter
+ NUMERIC_REGEXP = /^(-?(0[dbo])?[0-9_]+(\.[0-9_]+)?([eE]-?[0-9]+)?)\.([^.]*)$/
+ ARRAY_REGEXP = /^([^\]]*\])\.([^.]*)$/
+ SYMBOL_REGEXP = /^(:[^:.]*)$/
+ SYMBOL_METHOD_CALL_REGEXP = /^(:[^:.]+)\.([^.]*)$/
+ REGEX_REGEXP = /^(\/[^\/]*\/)\.([^.]*)$/
+ PROC_OR_HASH_REGEXP = /^([^\}]*\})\.([^.]*)$/
+ TOPLEVEL_LOOKUP_REGEXP = /^::([A-Z][^:\.\(]*)$/
+ CONSTANT_REGEXP = /^([A-Z][A-Za-z0-9]*)$/
+ CONSTANT_OR_METHOD_REGEXP = /^([A-Z].*)::([^:.]*)$/
+ HEX_REGEXP = /^(-?0x[0-9a-fA-F_]+)\.([^.]*)$/
+ GLOBALVARIABLE_REGEXP = /^(\$[^.]*)$/
+ VARIABLE_REGEXP = /^([^."].*)\.([^.]*)$/
+
+ ReservedWords = [
+ "BEGIN", "END",
+ "alias", "and",
+ "begin", "break",
+ "case", "class",
+ "def", "defined", "do",
+ "else", "elsif", "end", "ensure",
+ "false", "for",
+ "if", "in",
+ "module",
+ "next", "nil", "not",
+ "or",
+ "redo", "rescue", "retry", "return",
+ "self", "super",
+ "then", "true",
+ "undef", "unless", "until",
+ "when", "while",
+ "yield" ]
+
+ Operators = [
+ "%", "&", "*", "**", "+", "-", "/",
+ "<", "<<", "<=", "<=>", "==", "===", "=~", ">", ">=", ">>",
+ "[]", "[]=", "^", "!", "!=", "!~"
+ ]
+
+ WORD_ESCAPE_STR = " \t\n\"\\'`><=;|&{("
+
+ def initialize(input, pry = nil)
+ @pry = pry
+ @input = input
+ @input.basic_word_break_characters = WORD_ESCAPE_STR if @input.respond_to?(:basic_word_break_characters=)
+ @input.completion_append_character = nil if @input.respond_to?(:completion_append_character=)
+ end
+
+ #
+ # Return a new completion proc for use by Readline.
+ #
+ def call(str, options = {})
+ custom_completions = options[:custom_completions] || []
+ # if there are multiple contexts e.g. cd 1/2/3
+ # get new target for 1/2 and find candidates for 3
+ path, input = build_path(str)
+
+ if path.call.empty?
+ target = options[:target]
+ else
+ # Assume the user is tab-completing the 'cd' command
+ begin
+ target = Pry::ObjectPath.new(path.call, @pry.binding_stack).resolve.last
+ # but if that doesn't work, assume they're doing division with no spaces
+ rescue Pry::CommandError
+ target = options[:target]
+ end
+ end
+
+ begin
+ bind = target
+ # Complete stdlib symbols
+ case input
+ when REGEX_REGEXP # Regexp
+ receiver = $1
+ message = Regexp.quote($2)
+ candidates = Regexp.instance_methods.collect(&:to_s)
+ select_message(path, receiver, message, candidates)
+ when ARRAY_REGEXP # Array
+ receiver = $1
+ message = Regexp.quote($2)
+ candidates = Array.instance_methods.collect(&:to_s)
+ select_message(path, receiver, message, candidates)
+ when PROC_OR_HASH_REGEXP # Proc or Hash
+ receiver = $1
+ message = Regexp.quote($2)
+ candidates = Proc.instance_methods.collect(&:to_s)
+ candidates |= Hash.instance_methods.collect(&:to_s)
+ select_message(path, receiver, message, candidates)
+ when SYMBOL_REGEXP # Symbol
+ if Symbol.respond_to?(:all_symbols)
+ sym = Regexp.quote($1)
+ candidates = Symbol.all_symbols.collect{|s| ":" << s.id2name}
+ candidates.grep(/^#{sym}/)
+ else
+ []
+ end
+ when TOPLEVEL_LOOKUP_REGEXP # Absolute Constant or class methods
+ receiver = $1
+ candidates = Object.constants.collect(&:to_s)
+ candidates.grep(/^#{receiver}/).collect{|e| "::" << e}
+ when CONSTANT_REGEXP # Constant
+ message = $1
+ begin
+ context = target.eval("self")
+ context = context.class unless context.respond_to? :constants
+ candidates = context.constants.collect(&:to_s)
+ rescue
+ candidates = []
+ end
+ candidates = candidates.grep(/^#{message}/).collect(&path)
+ when CONSTANT_OR_METHOD_REGEXP # Constant or class methods
+ receiver = $1
+ message = Regexp.quote($2)
+ begin
+ candidates = eval("#{receiver}.constants.collect(&:to_s)", bind)
+ candidates |= eval("#{receiver}.methods.collect(&:to_s)", bind)
+ rescue Pry::RescuableException
+ candidates = []
+ end
+ candidates.grep(/^#{message}/).collect{|e| receiver + "::" + e}
+ when SYMBOL_METHOD_CALL_REGEXP # method call on a Symbol
+ receiver = $1
+ message = Regexp.quote($2)
+ candidates = Symbol.instance_methods.collect(&:to_s)
+ select_message(path, receiver, message, candidates)
+ when NUMERIC_REGEXP
+ # Numeric
+ receiver = $1
+ message = Regexp.quote($5)
+ begin
+ candidates = eval(receiver, bind).methods.collect(&:to_s)
+ rescue Pry::RescuableException
+ candidates = []
+ end
+ select_message(path, receiver, message, candidates)
+ when HEX_REGEXP
+ # Numeric(0xFFFF)
+ receiver = $1
+ message = Regexp.quote($2)
+ begin
+ candidates = eval(receiver, bind).methods.collect(&:to_s)
+ rescue Pry::RescuableException
+ candidates = []
+ end
+ select_message(path, receiver, message, candidates)
+ when GLOBALVARIABLE_REGEXP # global
+ regmessage = Regexp.new(Regexp.quote($1))
+ candidates = global_variables.collect(&:to_s).grep(regmessage)
+ when VARIABLE_REGEXP # variable
+ receiver = $1
+ message = Regexp.quote($2)
+
+ gv = eval("global_variables", bind).collect(&:to_s)
+ lv = eval("local_variables", bind).collect(&:to_s)
+ cv = eval("self.class.constants", bind).collect(&:to_s)
+
+ if (gv | lv | cv).include?(receiver) or /^[A-Z]/ =~ receiver && /\./ !~ receiver
+ # foo.func and foo is local var. OR
+ # Foo::Bar.func
+ begin
+ candidates = eval("#{receiver}.methods", bind).collect(&:to_s)
+ rescue Pry::RescuableException
+ candidates = []
+ end
+ else
+ # func1.func2
+ candidates = []
+ ObjectSpace.each_object(Module){|m|
+ begin
+ name = m.name.to_s
+ rescue Pry::RescuableException
+ name = ""
+ end
+ next if name != "IRB::Context" and
+ /^(IRB|SLex|RubyLex|RubyToken)/ =~ name
+
+ # jruby doesn't always provide #instance_methods() on each
+ # object.
+ if m.respond_to?(:instance_methods)
+ candidates.concat m.instance_methods(false).collect(&:to_s)
+ end
+ }
+ candidates.sort!
+ candidates.uniq!
+ end
+ select_message(path, receiver, message, candidates)
+ when /^\.([^.]*)$/
+ # Unknown(maybe String)
+ receiver = ""
+ message = Regexp.quote($1)
+ candidates = String.instance_methods(true).collect(&:to_s)
+ select_message(path, receiver, message, candidates)
+ else
+ candidates = eval(
+ "methods | private_methods | local_variables | " \
+ "self.class.constants | instance_variables",
+ bind
+ ).collect(&:to_s)
+
+ if eval("respond_to?(:class_variables)", bind)
+ candidates += eval("class_variables", bind).collect(&:to_s)
+ end
+ candidates = (candidates|ReservedWords|custom_completions).grep(/^#{Regexp.quote(input)}/)
+ candidates.collect(&path)
+ end
+ rescue Pry::RescuableException
+ []
+ end
+ end
+
+ def select_message(path, receiver, message, candidates)
+ candidates.grep(/^#{message}/).collect { |e|
+ case e
+ when /^[a-zA-Z_]/
+ path.call(receiver + "." << e)
+ when /^[0-9]/
+ when *Operators
+ #receiver + " " << e
+ end
+ }.compact
+ end
+
+ # build_path seperates the input into two parts: path and input.
+ # input is the partial string that should be completed
+ # path is a proc that takes an input and builds a full path.
+ def build_path(input)
+ # check to see if the input is a regex
+ return proc {|i| i.to_s }, input if input[/\/\./]
+ trailing_slash = input.end_with?('/')
+ contexts = input.chomp('/').split(/\//)
+ input = contexts[-1]
+ path = proc do |i|
+ p = contexts[0..-2].push(i).join('/')
+ p += '/' if trailing_slash && !i.nil?
+ p
+ end
+ return path, input
+ end
+end
diff --git a/.bundle/gems/pry-0.10.1/lib/pry/input_lock.rb b/.bundle/gems/pry-0.10.1/lib/pry/input_lock.rb
new file mode 100644
index 0000000..8adfed4
--- /dev/null
+++ b/.bundle/gems/pry-0.10.1/lib/pry/input_lock.rb
@@ -0,0 +1,132 @@
+require 'thread'
+
+class Pry
+ # There is one InputLock per input (such as STDIN) as two REPLs on the same
+ # input makes things delirious. InputLock serializes accesses to the input so
+ # that threads to not conflict with each other. The latest thread to request
+ # ownership of the input wins.
+ class InputLock
+ class Interrupt < Exception; end
+
+ class << self
+ attr_accessor :input_locks
+ attr_accessor :global_lock
+ end
+
+ self.input_locks = {}
+ self.global_lock = Mutex.new
+
+ def self.for(input)
+ # XXX This method leaks memory, as we never unregister an input once we
+ # are done with it. Fortunately, the leak is tiny (or so we hope). In
+ # usual scenarios, we would leak the StringIO that is passed to be
+ # evaluated from the command line.
+ global_lock.synchronize do
+ input_locks[input] ||= Pry::InputLock.new
+ end
+ end
+
+ def initialize
+ @mutex = Mutex.new
+ @cond = ConditionVariable.new
+ @owners = []
+ @interruptible = false
+ end
+
+ # Adds ourselves to the ownership list. The last one in the list may access
+ # the input through interruptible_region().
+ def __with_ownership(&block)
+ @mutex.synchronize do
+ # Three cases:
+ # 1) There are no owners, in this case we are good to go.
+ # 2) The current owner of the input is not reading the input (it might
+ # just be evaluating some ruby that the user typed).
+ # The current owner will figure out that it cannot go back to reading
+ # the input since we are adding ourselves to the @owners list, which
+ # in turns makes us the current owner.
+ # 3) The owner of the input is in the interruptible region, reading from
+ # the input. It's safe to send an Interrupt exception to interrupt
+ # the owner. It will then proceed like in case 2).
+ # We wait until the owner sets the interruptible flag back
+ # to false, meaning that he's out of the interruptible region.
+ # Note that the owner may receive multiple interrupts since, but that
+ # should be okay (and trying to avoid it is futile anyway).
+ while @interruptible
+ @owners.last.raise Interrupt
+ @cond.wait(@mutex)
+ end
+ @owners << Thread.current
+ end
+
+ block.call
+
+ ensure
+ @mutex.synchronize do
+ # We are releasing any desire to have the input ownership by removing
+ # ourselves from the list.
+ @owners.delete(Thread.current)
+
+ # We need to wake up the thread at the end of the @owners list, but
+ # sadly Ruby doesn't allow us to choose which one we wake up, so we wake
+ # them all up.
+ @cond.broadcast
+ end
+ end
+
+ def with_ownership(&block)
+ # If we are in a nested with_ownership() call (nested pry context), we do nothing.
+ nested = @mutex.synchronize { @owners.include?(Thread.current) }
+ nested ? block.call : __with_ownership(&block)
+ end
+
+ def enter_interruptible_region
+ @mutex.synchronize do
+ # We patiently wait until we are the owner. This may happen as another
+ # thread calls with_ownership() because of a binding.pry happening in
+ # another thread.
+ @cond.wait(@mutex) until @owners.last == Thread.current
+
+ # We are the legitimate owner of the input. We mark ourselves as
+ # interruptible, so other threads can send us an Interrupt exception
+ # while we are blocking from reading the input.
+ @interruptible = true
+ end
+ end
+
+ def leave_interruptible_region
+ @mutex.synchronize do
+ # We check if we are still the owner, because we could have received an
+ # Interrupt right after the following @cond.broadcast, making us retry.
+ @interruptible = false if @owners.last == Thread.current
+ @cond.broadcast
+ end
+ rescue Interrupt
+ # We need to guard against a spurious interrupt delivered while we are
+ # trying to acquire the lock (the rescue block is no longer in our scope).
+ retry
+ end
+
+ def interruptible_region(&block)
+ enter_interruptible_region
+
+ # XXX Note that there is a chance that we get the interrupt right after
+ # the readline call succeeded, but we'll never know, and we will retry the
+ # call, discarding that piece of input.
+ block.call
+
+ rescue Interrupt
+ # We were asked to back off. The one requesting the interrupt will be
+ # waiting on the conditional for the interruptible flag to change to false.
+ # Note that there can be some inefficiency, as we could immediately
+ # succeed in enter_interruptible_region(), even before the one requesting
+ # the ownership has the chance to register itself as an owner.
+ # To mitigate the issue, we sleep a little bit.
+ leave_interruptible_region
+ sleep 0.01
+ retry
+
+ ensure
+ leave_interruptible_region
+ end
+ end
+end
diff --git a/.bundle/gems/pry-0.10.1/lib/pry/inspector.rb b/.bundle/gems/pry-0.10.1/lib/pry/inspector.rb
new file mode 100644
index 0000000..c56b02f
--- /dev/null
+++ b/.bundle/gems/pry-0.10.1/lib/pry/inspector.rb
@@ -0,0 +1,27 @@
+class Pry::Inspector
+ MAP = {
+ "default" => {
+ value: Pry::DEFAULT_PRINT,
+ description: <<-DESCRIPTION.each_line.map(&:lstrip!)
+ The default Pry inspector. It has paging and color support, and uses
+ pretty_inspect when printing an object.
+ DESCRIPTION
+ },
+
+ "simple" => {
+ value: Pry::SIMPLE_PRINT,
+ description: <<-DESCRIPTION.each_line.map(&:lstrip)
+ A simple inspector that uses #puts and #inspect when printing an
+ object. It has no pager, color, or pretty_inspect support.
+ DESCRIPTION
+ },
+
+ "clipped" => {
+ value: Pry::CLIPPED_PRINT,
+ description: <<-DESCRIPTION.each_line.map(&:lstrip)
+ The clipped inspector has the same features as the 'simple' inspector
+ but prints large objects as a smaller string.
+ DESCRIPTION
+ }
+ }
+end
diff --git a/.bundle/gems/pry-0.10.1/lib/pry/last_exception.rb b/.bundle/gems/pry-0.10.1/lib/pry/last_exception.rb
new file mode 100644
index 0000000..2841113
--- /dev/null
+++ b/.bundle/gems/pry-0.10.1/lib/pry/last_exception.rb
@@ -0,0 +1,61 @@
+#
+# {Pry::LastException} is a proxy class who wraps an Exception object for
+# {Pry#last_exception}. it extends the exception object with methods that
+# help pry commands be useful.
+#
+# the original exception object is not modified and method calls are forwarded
+# to the wrapped exception object.
+#
+class Pry::LastException < BasicObject
+ attr_accessor :bt_index
+
+ def initialize(e)
+ @e = e
+ @bt_index = 0
+ @file, @line = bt_source_location_for(0)
+ end
+
+ def method_missing(name, *args, &block)
+ if @e.respond_to?(name)
+ @e.public_send(name, *args, &block)
+ else
+ super
+ end
+ end
+
+ def respond_to_missing?(name, include_private = false)
+ @e.respond_to?(name)
+ end
+
+ #
+ # @return [String]
+ # returns the path to a file for the current backtrace. see {#bt_index}.
+ #
+ def file
+ @file
+ end
+
+ #
+ # @return [Fixnum]
+ # returns the line for the current backtrace. see {#bt_index}.
+ #
+ def line
+ @line
+ end
+
+ # @return [Exception]
+ # returns the wrapped exception
+ #
+ def wrapped_exception
+ @e
+ end
+
+ def bt_source_location_for(index)
+ backtrace[index] =~ /(.*):(\d+)/
+ [$1, $2.to_i]
+ end
+
+ def inc_bt_index
+ @bt_index = (@bt_index + 1) % backtrace.size
+ end
+end
diff --git a/.bundle/gems/pry-0.10.1/lib/pry/method.rb b/.bundle/gems/pry-0.10.1/lib/pry/method.rb
new file mode 100644
index 0000000..03eb60a
--- /dev/null
+++ b/.bundle/gems/pry-0.10.1/lib/pry/method.rb
@@ -0,0 +1,546 @@
+require 'pry/helpers/documentation_helpers'
+
+class Pry
+ class << self
+ # If the given object is a `Pry::Method`, return it unaltered. If it's
+ # anything else, return it wrapped in a `Pry::Method` instance.
+ def Method(obj)
+ if obj.is_a? Pry::Method
+ obj
+ else
+ Pry::Method.new(obj)
+ end
+ end
+ end
+
+ # This class wraps the normal `Method` and `UnboundMethod` classes
+ # to provide extra functionality useful to Pry.
+ class Method
+ require 'pry/method/weird_method_locator'
+ require 'pry/method/disowned'
+ require 'pry/method/patcher'
+
+ extend Helpers::BaseHelpers
+ include Helpers::BaseHelpers
+ include Helpers::DocumentationHelpers
+ include CodeObject::Helpers
+
+ class << self
+ # Given a string representing a method name and optionally a binding to
+ # search in, find and return the requested method wrapped in a `Pry::Method`
+ # instance.
+ #
+ # @param [String] name The name of the method to retrieve.
+ # @param [Binding] target The context in which to search for the method.
+ # @param [Hash] options
+ # @option options [Boolean] :instance Look for an instance method if `name` doesn't
+ # contain any context.
+ # @option options [Boolean] :methods Look for a bound/singleton method if `name` doesn't
+ # contain any context.
+ # @return [Pry::Method, nil] A `Pry::Method` instance containing the requested
+ # method, or `nil` if name is `nil` or no method could be located matching the parameters.
+ def from_str(name, target=TOPLEVEL_BINDING, options={})
+ if name.nil?
+ nil
+ elsif name.to_s =~ /(.+)\#(\S+)\Z/
+ context, meth_name = $1, $2
+ from_module(target.eval(context), meth_name, target)
+ elsif name.to_s =~ /(.+)(\[\])\Z/
+ context, meth_name = $1, $2
+ from_obj(target.eval(context), meth_name, target)
+ elsif name.to_s =~ /(.+)(\.|::)(\S+)\Z/
+ context, meth_name = $1, $3
+ from_obj(target.eval(context), meth_name, target)
+ elsif options[:instance]
+ from_module(target.eval("self"), name, target)
+ elsif options[:methods]
+ from_obj(target.eval("self"), name, target)
+ else
+ from_str(name, target, :instance => true) or
+ from_str(name, target, :methods => true)
+ end
+
+ rescue Pry::RescuableException
+ nil
+ end
+
+ # Given a `Binding`, try to extract the `::Method` it originated from and
+ # use it to instantiate a `Pry::Method`. Return `nil` if this isn't
+ # possible.
+ #
+ # @param [Binding] b
+ # @return [Pry::Method, nil]
+ #
+ def from_binding(b)
+ meth_name = b.eval('::Kernel.__method__')
+ if [:__script__, nil].include?(meth_name)
+ nil
+ else
+ method = begin
+ if Object === b.eval('self')
+ new(Kernel.instance_method(:method).bind(b.eval("self")).call(meth_name))
+ else
+ new(b.eval('class << self; self; end.instance_method(::Kernel.__method__).bind(self)'))
+ end
+ rescue NameError, NoMethodError
+ Disowned.new(b.eval('self'), meth_name.to_s)
+ end
+
+ if WeirdMethodLocator.weird_method?(method, b)
+ WeirdMethodLocator.new(method, b).get_method || method
+ else
+ method
+ end
+ end
+ end
+
+ # In order to support 2.0 Refinements we need to look up methods
+ # inside the relevant Binding.
+ # @param [Object] obj The owner/receiver of the method.
+ # @param [Symbol] method_name The name of the method.
+ # @param [Symbol] method_type The type of method: :method or :instance_method
+ # @param [Binding] target The binding where the method is looked up.
+ # @return [Method, UnboundMethod] The 'refined' method object.
+ def lookup_method_via_binding(obj, method_name, method_type, target=TOPLEVEL_BINDING)
+ Pry.current[:obj] = obj
+ Pry.current[:name] = method_name
+ receiver = obj.is_a?(Module) ? "Module" : "Kernel"
+ target.eval("::#{receiver}.instance_method(:#{method_type}).bind(Pry.current[:obj]).call(Pry.current[:name])")
+ ensure
+ Pry.current[:obj] = Pry.current[:name] = nil
+ end
+
+ # Given a `Class` or `Module` and the name of a method, try to
+ # instantiate a `Pry::Method` containing the instance method of
+ # that name. Return `nil` if no such method exists.
+ #
+ # @param [Class, Module] klass
+ # @param [String] name
+ # @param [Binding] target The binding where the method is looked up.
+ # @return [Pry::Method, nil]
+ def from_class(klass, name, target=TOPLEVEL_BINDING)
+ new(lookup_method_via_binding(klass, name, :instance_method, target)) rescue nil
+ end
+ alias from_module from_class
+
+ # Given an object and the name of a method, try to instantiate
+ # a `Pry::Method` containing the method of that name bound to
+ # that object. Return `nil` if no such method exists.
+ #
+ # @param [Object] obj
+ # @param [String] name
+ # @param [Binding] target The binding where the method is looked up.
+ # @return [Pry::Method, nil]
+ def from_obj(obj, name, target=TOPLEVEL_BINDING)
+ new(lookup_method_via_binding(obj, name, :method, target)) rescue nil
+ end
+
+ # Get all of the instance methods of a `Class` or `Module`
+ # @param [Class,Module] klass
+ # @param [Boolean] include_super Whether to include methods from ancestors.
+ # @return [Array[Pry::Method]]
+ def all_from_class(klass, include_super=true)
+ %w(public protected private).map do |visibility|
+ safe_send(klass, :"#{visibility}_instance_methods", include_super).map do |method_name|
+ new(safe_send(klass, :instance_method, method_name), :visibility => visibility.to_sym)
+ end
+ end.flatten(1)
+ end
+
+ #
+ # Get all of the methods on an `Object`
+ #
+ # @param [Object] obj
+ #
+ # @param [Boolean] include_super
+ # indicates whether or not to include methods from ancestors.
+ #
+ # @return [Array[Pry::Method]]
+ #
+ def all_from_obj(obj, include_super=true)
+ all_from_class(singleton_class_of(obj), include_super)
+ end
+
+ #
+ # @deprecated
+ # please use {#all_from_obj} instead.
+ # the `method_type` argument is ignored.
+ #
+ def all_from_common(obj, method_type = nil, include_super=true)
+ all_from_obj(obj, include_super)
+ end
+
+ # Get every `Class` and `Module`, in order, that will be checked when looking
+ # for an instance method to call on this object.
+ # @param [Object] obj
+ # @return [Array[Class, Module]]
+ def resolution_order(obj)
+ if Class === obj
+ singleton_class_resolution_order(obj) + instance_resolution_order(Class)
+ else
+ klass = singleton_class_of(obj) rescue obj.class
+ instance_resolution_order(klass)
+ end
+ end
+
+ # Get every `Class` and `Module`, in order, that will be checked when looking
+ # for methods on instances of the given `Class` or `Module`.
+ # This does not treat singleton classes of classes specially.
+ # @param [Class, Module] klass
+ # @return [Array[Class, Module]]
+ def instance_resolution_order(klass)
+ # include klass in case it is a singleton class,
+ ([klass] + Pry::Method.safe_send(klass, :ancestors)).uniq
+ end
+
+ def method_definition?(name, definition_line)
+ singleton_method_definition?(name, definition_line) ||
+ instance_method_definition?(name, definition_line)
+ end
+
+ def singleton_method_definition?(name, definition_line)
+ /^define_singleton_method\(?\s*[:\"\']#{Regexp.escape(name)}|^def\s*self\.#{Regexp.escape(name)}/ =~ definition_line.strip
+ end
+
+ def instance_method_definition?(name, definition_line)
+ /^define_method\(?\s*[:\"\']#{Regexp.escape(name)}|^def\s*#{Regexp.escape(name)}/ =~ definition_line.strip
+ end
+
+ # Get the singleton classes of superclasses that could define methods on
+ # the given class object, and any modules they include.
+ # If a module is included at multiple points in the ancestry, only
+ # the lowest copy will be returned.
+ def singleton_class_resolution_order(klass)
+ ancestors = Pry::Method.safe_send(klass, :ancestors)
+ resolution_order = ancestors.grep(Class).map do |anc|
+ [singleton_class_of(anc), *singleton_class_of(anc).included_modules]
+ end.flatten(1)
+
+ resolution_order.reverse.uniq.reverse - Class.included_modules
+ end
+
+ def singleton_class_of(obj)
+ begin
+ class << obj; self; end
+ rescue TypeError # can't define singleton. Fixnum, Symbol, Float, ...
+ obj.class
+ end
+ end
+ end
+
+ # A new instance of `Pry::Method` wrapping the given `::Method`, `UnboundMethod`, or `Proc`.
+ #
+ # @param [::Method, UnboundMethod, Proc] method
+ # @param [Hash] known_info Can be used to pre-cache expensive to compute stuff.
+ # @return [Pry::Method]
+ def initialize(method, known_info={})
+ @method = method
+ @visibility = known_info[:visibility]
+ end
+
+ # Get the name of the method as a String, regardless of the underlying Method#name type.
+ # @return [String]
+ def name
+ @method.name.to_s
+ end
+
+ # Get the owner of the method as a Pry::Module
+ # @return [Pry::Module]
+ def wrapped_owner
+ @wrapped_owner ||= Pry::WrappedModule.new(owner)
+ end
+
+ # Get underlying object wrapped by this Pry::Method instance
+ # @return [Method, UnboundMethod, Proc]
+ def wrapped
+ @method
+ end
+
+ # Is the method undefined? (aka `Disowned`)
+ # @return [Boolean] false
+ def undefined?
+ false
+ end
+
+ # Get the name of the method including the class on which it was defined.
+ # @example
+ # method(:puts).method_name
+ # => "Kernel.puts"
+ # @return [String]
+ def name_with_owner
+ "#{wrapped_owner.method_prefix}#{name}"
+ end
+
+ # @return [String, nil] The source code of the method, or `nil` if it's unavailable.
+ def source
+ @source ||= case source_type
+ when :c
+ c_source
+ when :ruby
+ ruby_source
+ end
+ end
+
+ # Update the live copy of the method's source.
+ def redefine(source)
+ Patcher.new(self).patch_in_ram source
+ Pry::Method(owner.instance_method(name))
+ end
+
+ # Can we get the source code for this method?
+ # @return [Boolean]
+ def source?
+ !!source
+ rescue MethodSource::SourceNotFoundError
+ false
+ end
+
+ # @return [String, nil] The documentation for the method, or `nil` if it's
+ # unavailable.
+ def doc
+ @doc ||= case source_type
+ when :c
+ info = pry_doc_info
+ info.docstring if info
+ when :ruby
+ get_comment_content(comment)
+ end
+ end
+
+ # @return [Symbol] The source type of the method. The options are
+ # `:ruby` for Ruby methods or `:c` for methods written in C.
+ def source_type
+ source_location.nil? ? :c : :ruby
+ end
+
+ # @return [String, nil] The name of the file the method is defined in, or
+ # `nil` if the filename is unavailable.
+ def source_file
+ if source_location.nil?
+ if !rbx? and source_type == :c
+ info = pry_doc_info
+ info.file if info
+ end
+ else
+ source_location.first
+ end
+ end
+
+ # @return [Fixnum, nil] The line of code in `source_file` which begins
+ # the method's definition, or `nil` if that information is unavailable.
+ def source_line
+ source_location.nil? ? nil : source_location.last
+ end
+
+ # @return [Range, nil] The range of lines in `source_file` which contain
+ # the method's definition, or `nil` if that information is unavailable.
+ def source_range
+ source_location.nil? ? nil : (source_line)..(source_line + source.lines.count - 1)
+ end
+
+ # @return [Symbol] The visibility of the method. May be `:public`,
+ # `:protected`, or `:private`.
+ def visibility
+ @visibility ||= if owner.public_instance_methods.any? { |m| m.to_s == name }
+ :public
+ elsif owner.protected_instance_methods.any? { |m| m.to_s == name }
+ :protected
+ elsif owner.private_instance_methods.any? { |m| m.to_s == name }
+ :private
+ else
+ :none
+ end
+ end
+
+ # @return [String] A representation of the method's signature, including its
+ # name and parameters. Optional and "rest" parameters are marked with `*`
+ # and block parameters with `&`. If the parameter names are unavailable,
+ # they're given numbered names instead.
+ # Paraphrased from `awesome_print` gem.
+ def signature
+ if respond_to?(:parameters)
+ args = parameters.inject([]) do |arr, (type, name)|
+ name ||= (type == :block ? 'block' : "arg#{arr.size + 1}")
+ arr << case type
+ when :req then name.to_s
+ when :opt then "#{name}=?"
+ when :rest then "*#{name}"
+ when :block then "{name}"
+ else '?'
+ end
+ end
+ else
+ args = (1..arity.abs).map { |i| "arg#{i}" }
+ args[-1] = "*#{args[-1]}" if arity < 0
+ end
+
+ "#{name}(#{args.join(', ')})"
+ end
+
+ # @return [Pry::Method, nil] The wrapped method that is called when you
+ # use "super" in the body of this method.
+ def super(times=1)
+ if UnboundMethod === @method
+ sup = super_using_ancestors(Pry::Method.instance_resolution_order(owner), times)
+ else
+ sup = super_using_ancestors(Pry::Method.resolution_order(receiver), times)
+ sup &&= sup.bind(receiver)
+ end
+ Pry::Method.new(sup) if sup
+ end
+
+ # @return [String, nil] The original name the method was defined under,
+ # before any aliasing, or `nil` if it can't be determined.
+ def original_name
+ return nil if source_type != :ruby
+ method_name_from_first_line(source.lines.first)
+ end
+
+ # @return [Boolean] Was the method defined outside a source file?
+ def dynamically_defined?
+ !!(source_file and source_file =~ /(\(.*\))|<.*>/)
+ end
+
+ # @return [Boolean] Whether the method is unbound.
+ def unbound_method?
+ is_a?(::UnboundMethod)
+ end
+
+ # @return [Boolean] Whether the method is bound.
+ def bound_method?
+ is_a?(::Method)
+ end
+
+ # @return [Boolean] Whether the method is a singleton method.
+ def singleton_method?
+ wrapped_owner.singleton_class?
+ end
+
+ # @return [Boolean] Was the method defined within the Pry REPL?
+ def pry_method?
+ source_file == Pry.eval_path
+ end
+
+ # @return [Array] All known aliases for the method.
+ def aliases
+ owner = @method.owner
+ # Avoid using `to_sym` on {Method#name}, which returns a `String`, because
+ # it won't be garbage collected.
+ name = @method.name
+
+ all_methods_to_compare = owner.instance_methods | owner.private_instance_methods
+ alias_list = all_methods_to_compare.combination(2).select do |pair|
+ pair.include?(name) &&
+ owner.instance_method(pair.first) == owner.instance_method(pair.last)
+ end.flatten
+ alias_list.delete(name)
+
+ alias_list.map(&:to_s)
+ end
+
+ # @return [Boolean] Is the method definitely an alias?
+ def alias?
+ name != original_name
+ end
+
+ # @return [Boolean]
+ def ==(obj)
+ if obj.is_a? Pry::Method
+ obj == @method
+ else
+ @method == obj
+ end
+ end
+
+ # @param [Class] klass
+ # @return [Boolean]
+ def is_a?(klass)
+ klass == Pry::Method or @method.is_a?(klass)
+ end
+ alias kind_of? is_a?
+
+ # @param [String, Symbol] method_name
+ # @return [Boolean]
+ def respond_to?(method_name)
+ super or @method.respond_to?(method_name)
+ end
+
+ # Delegate any unknown calls to the wrapped method.
+ def method_missing(method_name, *args, &block)
+ @method.send(method_name, *args, &block)
+ end
+
+ def comment
+ Pry::Code.from_file(source_file).comment_describing(source_line)
+ end
+
+ private
+
+ # @return [YARD::CodeObjects::MethodObject]
+ # @raise [CommandError] when the method can't be found or `pry-doc` isn't installed.
+ def pry_doc_info
+ if Pry.config.has_pry_doc
+ Pry::MethodInfo.info_for(@method) or raise CommandError, "Cannot locate this method: #{name}. (source_location returns nil)"
+ else
+ fail_msg = "Cannot locate this method: #{name}."
+ if mri?
+ fail_msg += ' Try `gem-install pry-doc` to get access to Ruby Core documentation.'
+ end
+ raise CommandError, fail_msg
+ end
+ end
+
+ # @param [Class, Module] ancestors The ancestors to investigate
+ # @return [Method] The unwrapped super-method
+ def super_using_ancestors(ancestors, times=1)
+ next_owner = self.owner
+ times.times do
+ i = ancestors.index(next_owner) + 1
+ while ancestors[i] && !(ancestors[i].method_defined?(name) || ancestors[i].private_method_defined?(name))
+ i += 1
+ end
+ next_owner = ancestors[i] or return nil
+ end
+
+ safe_send(next_owner, :instance_method, name) rescue nil
+ end
+
+ # @param [String] first_ln The first line of a method definition.
+ # @return [String, nil]
+ def method_name_from_first_line(first_ln)
+ return nil if first_ln.strip !~ /^def /
+
+ tokens = CodeRay.scan(first_ln, :ruby)
+ tokens = tokens.tokens.each_slice(2) if tokens.respond_to?(:tokens)
+ tokens.each_cons(2) do |t1, t2|
+ if t2.last == :method || t2.last == :ident && t1 == [".", :operator]
+ return t2.first
+ end
+ end
+
+ nil
+ end
+
+ def c_source
+ info = pry_doc_info
+ if info and info.source
+ strip_comments_from_c_code(info.source)
+ end
+ end
+
+ def ruby_source
+ # clone of MethodSource.source_helper that knows to use our
+ # hacked version of source_location for rbx core methods, and
+ # our input buffer for methods defined in (pry)
+ file, line = *source_location
+ raise SourceNotFoundError, "Could not locate source for #{name_with_owner}!" unless file
+
+ begin
+ code = Pry::Code.from_file(file).expression_at(line)
+ rescue SyntaxError => e
+ raise MethodSource::SourceNotFoundError.new(e.message)
+ end
+ strip_leading_whitespace(code)
+ end
+ end
+end
diff --git a/.bundle/gems/pry-0.10.1/lib/pry/method/disowned.rb b/.bundle/gems/pry-0.10.1/lib/pry/method/disowned.rb
new file mode 100644
index 0000000..35908c9
--- /dev/null
+++ b/.bundle/gems/pry-0.10.1/lib/pry/method/disowned.rb
@@ -0,0 +1,53 @@
+class Pry
+ class Method
+ # A Disowned Method is one that's been removed from the class on which it was defined.
+ #
+ # e.g.
+ # class C
+ # def foo
+ # C.send(:undefine_method, :foo)
+ # Pry::Method.from_binding(binding)
+ # end
+ # end
+ #
+ # In this case we assume that the "owner" is the singleton class of the receiver.
+ #
+ # This occurs mainly in Sinatra applications.
+ class Disowned < Method
+ attr_reader :receiver, :name
+
+ # Create a new Disowned method.
+ #
+ # @param [Object] receiver
+ # @param [String] method_name
+ def initialize(receiver, method_name, binding=nil)
+ @receiver, @name = receiver, method_name
+ end
+
+ # Is the method undefined? (aka `Disowned`)
+ # @return [Boolean] true
+ def undefined?
+ true
+ end
+
+ # Can we get the source for this method?
+ # @return [Boolean] false
+ def source?
+ false
+ end
+
+ # Get the hypothesized owner of the method.
+ #
+ # @return [Object]
+ def owner
+ class << receiver; self; end
+ end
+
+ # Raise a more useful error message instead of trying to forward to nil.
+ def method_missing(meth_name, *args, &block)
+ raise "Cannot call '#{meth_name}' on an undef'd method." if method(:name).respond_to?(meth_name)
+ Object.instance_method(:method_missing).bind(self).call(meth_name, *args, &block)
+ end
+ end
+ end
+end
diff --git a/.bundle/gems/pry-0.10.1/lib/pry/method/patcher.rb b/.bundle/gems/pry-0.10.1/lib/pry/method/patcher.rb
new file mode 100644
index 0000000..3f736f6
--- /dev/null
+++ b/.bundle/gems/pry-0.10.1/lib/pry/method/patcher.rb
@@ -0,0 +1,125 @@
+class Pry
+ class Method
+ class Patcher
+ attr_accessor :method
+
+ @@source_cache = {}
+
+ def initialize(method)
+ @method = method
+ end
+
+ def self.code_for(filename)
+ @@source_cache[filename]
+ end
+
+ # perform the patch
+ def patch_in_ram(source)
+ if method.alias?
+ with_method_transaction do
+ redefine source
+ end
+ else
+ redefine source
+ end
+ end
+
+ private
+
+ def redefine(source)
+ @@source_cache[cache_key] = source
+ TOPLEVEL_BINDING.eval wrap(source), cache_key
+ end
+
+ def cache_key
+ "pry-redefined(0x#{method.owner.object_id.to_s(16)}##{method.name})"
+ end
+
+ # Run some code ensuring that at the end target#meth_name will not have changed.
+ #
+ # When we're redefining aliased methods we will overwrite the method at the
+ # unaliased name (so that super continues to work). By wrapping that code in a
+ # transation we make that not happen, which means that alias_method_chains, etc.
+ # continue to work.
+ #
+ # @param [String] meth_name The method name before aliasing
+ # @param [Module] target The owner of the method
+
+ def with_method_transaction
+ temp_name = "__pry_#{method.original_name}__"
+ method = self.method
+ method.owner.class_eval do
+ alias_method temp_name, method.original_name
+ yield
+ alias_method method.name, method.original_name
+ alias_method method.original_name, temp_name
+ end
+
+ ensure
+ method.send(:remove_method, temp_name) rescue nil
+ end
+
+ # Update the definition line so that it can be eval'd directly on the Method's
+ # owner instead of from the original context.
+ #
+ # In particular this takes `def self.foo` and turns it into `def foo` so that we
+ # don't end up creating the method on the singleton class of the singleton class
+ # by accident.
+ #
+ # This is necessarily done by String manipulation because we can't find out what
+ # syntax is needed for the argument list by ruby-level introspection.
+ #
+ # @param [String] line The original definition line. e.g. def self.foo(bar, baz=1)
+ # @return [String] The new definition line. e.g. def foo(bar, baz=1)
+ def definition_for_owner(line)
+ if line =~ /\Adef (?:.*?\.)?#{Regexp.escape(method.original_name)}(?=[\(\s;]|$)/
+ "def #{method.original_name}#{$'}"
+ else
+ raise CommandError, "Could not find original `def #{method.original_name}` line to patch."
+ end
+ end
+
+ # Apply wrap_for_owner and wrap_for_nesting successively to `source`
+ # @param [String] source
+ # @return [String] The wrapped source.
+ def wrap(source)
+ wrap_for_nesting(wrap_for_owner(source))
+ end
+
+ # Update the source code so that when it has the right owner when eval'd.
+ #
+ # This (combined with definition_for_owner) is backup for the case that
+ # wrap_for_nesting fails, to ensure that the method will stil be defined in
+ # the correct place.
+ #
+ # @param [String] source The source to wrap
+ # @return [String]
+ def wrap_for_owner(source)
+ Pry.current[:pry_owner] = method.owner
+ owner_source = definition_for_owner(source)
+ visibility_fix = "#{method.visibility.to_s} #{method.name.to_sym.inspect}"
+ "Pry.current[:pry_owner].class_eval do; #{owner_source}\n#{visibility_fix}\nend"
+ end
+
+ # Update the new source code to have the correct Module.nesting.
+ #
+ # This method uses syntactic analysis of the original source file to determine
+ # the new nesting, so that we can tell the difference between:
+ #
+ # class A; def self.b; end; end
+ # class << A; def b; end; end
+ #
+ # The resulting code should be evaluated in the TOPLEVEL_BINDING.
+ #
+ # @param [String] source The source to wrap.
+ # @return [String]
+ def wrap_for_nesting(source)
+ nesting = Pry::Code.from_file(method.source_file).nesting_at(method.source_line)
+
+ (nesting + [source] + nesting.map{ "end" } + [""]).join(";")
+ rescue Pry::Indent::UnparseableNestingError
+ source
+ end
+ end
+ end
+end
diff --git a/.bundle/gems/pry-0.10.1/lib/pry/method/weird_method_locator.rb b/.bundle/gems/pry-0.10.1/lib/pry/method/weird_method_locator.rb
new file mode 100644
index 0000000..a668d16
--- /dev/null
+++ b/.bundle/gems/pry-0.10.1/lib/pry/method/weird_method_locator.rb
@@ -0,0 +1,186 @@
+class Pry
+ class Method
+
+ # This class is responsible for locating the *real* `Pry::Method`
+ # object captured by a binding.
+ #
+ # Given a `Binding` from inside a method and a 'seed' Pry::Method object,
+ # there are primarily two situations where the seed method doesn't match
+ # the Binding:
+ # 1. The Pry::Method is from a subclass 2. The Pry::Method represents a method of the same name
+ # while the original was renamed to something else. For 1. we
+ # search vertically up the inheritance chain,
+ # and for 2. we search laterally along the object's method table.
+ #
+ # When we locate the method that matches the Binding we wrap it in
+ # Pry::Method and return it, or return nil if we fail.
+ class WeirdMethodLocator
+ class << self
+
+ # Whether the given method object matches the associated binding.
+ # If the method object does not match the binding, then it's
+ # most likely not the method captured by the binding, and we
+ # must commence a search.
+ #
+ # @param [Pry::Method] method
+ # @param [Binding] b
+ # @return [Boolean]
+ def normal_method?(method, b)
+ method && (method.source_file && method.source_range rescue false) &&
+ File.expand_path(method.source_file) == File.expand_path(b.eval('__FILE__')) &&
+ method.source_range.include?(b.eval('__LINE__'))
+ end
+
+ def weird_method?(method, b)
+ !normal_method?(method, b)
+ end
+ end
+
+ attr_accessor :method
+ attr_accessor :target
+
+ # @param [Pry::Method] method The seed method.
+ # @param [Binding] target The Binding that captures the method
+ # we want to locate.
+ def initialize(method, target)
+ @method, @target = method, target
+ end
+
+ # @return [Pry::Method, nil] The Pry::Method that matches the
+ # given binding.
+ def get_method
+ find_method_in_superclass || find_renamed_method
+ end
+
+ # @return [Boolean] Whether the Pry::Method is unrecoverable
+ # This usually happens when the method captured by the Binding
+ # has been subsequently deleted.
+ def lost_method?
+ !!(get_method.nil? && renamed_method_source_location)
+ end
+
+ private
+
+ def normal_method?(method)
+ self.class.normal_method?(method, target)
+ end
+
+ def target_self
+ target.eval('self')
+ end
+
+ def target_file
+ pry_file? ? target.eval('__FILE__') : File.expand_path(target.eval('__FILE__'))
+ end
+
+ def target_line
+ target.eval('__LINE__')
+ end
+
+ def pry_file?
+ Pry.eval_path == target.eval('__FILE__')
+ end
+
+ # it's possible in some cases that the method we find by this approach is a sub-method of
+ # the one we're currently in, consider:
+ #
+ # class A; def b; binding.pry; end; end
+ # class B < A; def b; super; end; end
+ #
+ # Given that we can normally find the source_range of methods, and that we know which
+ # __FILE__ and __LINE__ the binding is at, we can hope to disambiguate these cases.
+ #
+ # This obviously won't work if the source is unavaiable for some reason, or if both
+ # methods have the same __FILE__ and __LINE__, or if we're in rbx where b.eval('__LINE__')
+ # is broken.
+ #
+ # @return [Pry::Method, nil] The Pry::Method representing the
+ # superclass method.
+ def find_method_in_superclass
+ guess = method
+
+ while guess
+ # needs rescue if this is a Disowned method or a C method or something...
+ # TODO: Fix up the exception handling so we don't need a bare rescue
+ if normal_method?(guess)
+ return guess
+ else
+ guess = guess.super
+ end
+ end
+
+ # Uhoh... none of the methods in the chain had the right __FILE__ and __LINE__
+ # This may be caused by rbx https://github.com/rubinius/rubinius/issues/953,
+ # or other unknown circumstances (TODO: we should warn the user when this happens)
+ nil
+ end
+
+ # This is the case where the name of a method has changed
+ # (via alias_method) so we locate the Method object for the
+ # renamed method.
+ #
+ # @return [Pry::Method, nil] The Pry::Method representing the
+ # renamed method
+ def find_renamed_method
+ return if !valid_file?(target_file)
+ alias_name = all_methods_for(target_self).find do |v|
+ expanded_source_location(target_self.method(v).source_location) == renamed_method_source_location
+ end
+
+ alias_name && Pry::Method(target_self.method(alias_name))
+ end
+
+ def expanded_source_location(sl)
+ return if !sl
+
+ if pry_file?
+ sl
+ else
+ [File.expand_path(sl.first), sl.last]
+ end
+ end
+
+ # Use static analysis to locate the start of the method definition.
+ # We have the `__FILE__` and `__LINE__` from the binding and the
+ # original name of the method so we search up until we find a
+ # def/define_method, etc defining a method of the appropriate name.
+ #
+ # @return [Array] The `source_location` of the
+ # renamed method
+ def renamed_method_source_location
+ return @original_method_source_location if defined?(@original_method_source_location)
+
+ source_index = lines_for_file(target_file)[0..(target_line - 1)].rindex do |v|
+ Pry::Method.method_definition?(method.name, v)
+ end
+
+ @original_method_source_location = source_index &&
+ [target_file, index_to_line_number(source_index)]
+ end
+
+ def index_to_line_number(index)
+ # Pry.line_buffer is 0-indexed
+ pry_file? ? index : index + 1
+ end
+
+ def valid_file?(file)
+ (File.exist?(file) && !File.directory?(file)) || Pry.eval_path == file
+ end
+
+ def lines_for_file(file)
+ @lines_for_file ||= {}
+ @lines_for_file[file] ||= if Pry.eval_path == file
+ Pry.line_buffer
+ else
+ File.readlines(file)
+ end
+ end
+
+ def all_methods_for(obj)
+ obj.public_methods(false) +
+ obj.private_methods(false) +
+ obj.protected_methods(false)
+ end
+ end
+ end
+end
diff --git a/.bundle/gems/pry-0.10.1/lib/pry/module_candidate.rb b/.bundle/gems/pry-0.10.1/lib/pry/module_candidate.rb
new file mode 100644
index 0000000..4c97f13
--- /dev/null
+++ b/.bundle/gems/pry-0.10.1/lib/pry/module_candidate.rb
@@ -0,0 +1,136 @@
+require 'pry/helpers/documentation_helpers'
+require 'forwardable'
+
+class Pry
+ class WrappedModule
+
+ # This class represents a single candidate for a module/class definition.
+ # It provides access to the source, documentation, line and file
+ # for a monkeypatch (reopening) of a class/module.
+ class Candidate
+ include Pry::Helpers::DocumentationHelpers
+ include Pry::CodeObject::Helpers
+ extend Forwardable
+
+ # @return [String] The file where the module definition is located.
+ attr_reader :file
+ alias_method :source_file, :file
+
+ # @return [Fixnum] The line where the module definition is located.
+ attr_reader :line
+ alias_method :source_line, :line
+
+ # Methods to delegate to associated `Pry::WrappedModule
+ # instance`.
+ private_delegates = [:lines_for_file, :method_candidates,
+ :yard_docs?]
+
+ public_delegates = [:wrapped, :module?, :class?, :name, :nonblank_name,
+ :number_of_candidates]
+
+ def_delegators :@wrapper, *(private_delegates + public_delegates)
+ private(*private_delegates)
+ public(*public_delegates)
+
+ # @raise [Pry::CommandError] If `rank` is out of bounds.
+ # @param [Pry::WrappedModule] wrapper The associated
+ # `Pry::WrappedModule` instance that owns the candidates.
+ # @param [Fixnum] rank The rank of the candidate to
+ # retrieve. Passing 0 returns 'primary candidate' (the candidate with largest
+ # number of methods), passing 1 retrieves candidate with
+ # second largest number of methods, and so on, up to
+ # `Pry::WrappedModule#number_of_candidates() - 1`
+ def initialize(wrapper, rank)
+ @wrapper = wrapper
+
+ if number_of_candidates <= 0
+ raise CommandError, "Cannot find a definition for #{name} module!"
+ elsif rank > (number_of_candidates - 1)
+ raise CommandError, "No such module candidate. Allowed candidates range is from 0 to #{number_of_candidates - 1}"
+ end
+
+ @rank = rank
+ @file, @line = source_location
+ end
+
+ # @raise [Pry::CommandError] If source code cannot be found.
+ # @return [String] The source for the candidate, i.e the
+ # complete module/class definition.
+ def source
+ return nil if file.nil?
+ return @source if @source
+
+ @source = strip_leading_whitespace(Pry::Code.from_file(file).expression_at(line, number_of_lines_in_first_chunk))
+ end
+
+ # @raise [Pry::CommandError] If documentation cannot be found.
+ # @return [String] The documentation for the candidate.
+ def doc
+ return nil if file.nil?
+ return @doc if @doc
+
+ @doc = get_comment_content(Pry::Code.from_file(file).comment_describing(line))
+ end
+
+ # @return [Array, nil] A `[String, Fixnum]` pair representing the
+ # source location (file and line) for the candidate or `nil`
+ # if no source location found.
+ def source_location
+ return @source_location if @source_location
+
+ file, line = first_method_source_location
+ return nil if !file.is_a?(String)
+
+ @source_location = [file, first_line_of_module_definition(file, line)]
+ rescue Pry::RescuableException
+ nil
+ end
+
+ private
+
+ # Locate the first line of the module definition.
+ # @param [String] file The file that contains the module
+ # definition (somewhere).
+ # @param [Fixnum] line The module definition should appear
+ # before this line (if it exists).
+ # @return [Fixnum] The line where the module is defined. This
+ # line number is one-indexed.
+ def first_line_of_module_definition(file, line)
+ searchable_lines = lines_for_file(file)[0..(line - 2)]
+ searchable_lines.rindex { |v| class_regexes.any? { |r| r =~ v } } + 1
+ end
+
+ def class_regexes
+ mod_type_string = wrapped.class.to_s.downcase
+ [/^\s*#{mod_type_string}\s+(?:(?:\w*)::)*?#{wrapped.name.split(/::/).last}/,
+ /^\s*(::)?#{wrapped.name.split(/::/).last}\s*?=\s*?#{wrapped.class}/,
+ /^\s*(::)?#{wrapped.name.split(/::/).last}\.(class|instance)_eval/]
+ end
+
+ # This method is used by `Candidate#source_location` as a
+ # starting point for the search for the candidate's definition.
+ # @return [Array] The source location of the base method used to
+ # calculate the source location of the candidate.
+ def first_method_source_location
+ @first_method_source_location ||= method_candidates[@rank].first.source_location
+ end
+
+ # @return [Array] The source location of the last method in this
+ # candidate's module definition.
+ def last_method_source_location
+ @end_method_source_location ||= method_candidates[@rank].last.source_location
+ end
+
+ # Return the number of lines between the start of the class definition
+ # and the start of the last method. We use this value so we can
+ # quickly grab these lines from the file (without having to
+ # check each intervening line for validity, which is expensive) speeding up source extraction.
+ # @return [Fixum] Number of lines.
+ def number_of_lines_in_first_chunk
+ end_method_line = last_method_source_location.last
+
+ end_method_line - line
+ end
+ end
+ end
+end
diff --git a/.bundle/gems/pry-0.10.1/lib/pry/object_path.rb b/.bundle/gems/pry-0.10.1/lib/pry/object_path.rb
new file mode 100644
index 0000000..5bffb02
--- /dev/null
+++ b/.bundle/gems/pry-0.10.1/lib/pry/object_path.rb
@@ -0,0 +1,82 @@
+class Pry
+ # `ObjectPath` implements the resolution of "object paths", which are strings
+ # that are similar to filesystem paths but meant for traversing Ruby objects.
+ # Examples of valid object paths include:
+ #
+ # x
+ # @foo/@bar
+ # "string"/upcase
+ # Pry/Method
+ #
+ # Object paths are mostly relevant in the context of the `cd` command.
+ # @see https://github.com/pry/pry/wiki/State-navigation
+ class ObjectPath
+ SPECIAL_TERMS = ["", "::", ".", ".."]
+
+ # @param [String] path_string The object path expressed as a string.
+ # @param [Array] current_stack The current state of the binding
+ # stack.
+ def initialize(path_string, current_stack)
+ @path_string = path_string
+ @current_stack = current_stack
+ end
+
+ # @return [Array] a new stack resulting from applying the given
+ # path to the current stack.
+ def resolve
+ scanner = StringScanner.new(@path_string.strip)
+ stack = @current_stack.dup
+
+ begin
+ next_segment = ""
+
+ loop do
+ # Scan for as long as we don't see a slash
+ next_segment << scanner.scan(/[^\/]*/)
+
+ if complete?(next_segment) || scanner.eos?
+ scanner.getch # consume the slash
+ break
+ else
+ next_segment << scanner.getch # append the slash
+ end
+ end
+
+ case next_segment.chomp
+ when ""
+ stack = [stack.first]
+ when "::"
+ stack.push(TOPLEVEL_BINDING)
+ when "."
+ next
+ when ".."
+ stack.pop unless stack.size == 1
+ else
+ stack.push(Pry.binding_for(stack.last.eval(next_segment)))
+ end
+ rescue RescuableException => e
+ return handle_failure(next_segment, e)
+ end until scanner.eos?
+
+ stack
+ end
+
+ private
+
+ def complete?(segment)
+ SPECIAL_TERMS.include?(segment) || Pry::Code.complete_expression?(segment)
+ end
+
+ def handle_failure(context, err)
+ msg = [
+ "Bad object path: #{@path_string.inspect}",
+ "Failed trying to resolve: #{context.inspect}",
+ "Exception: #{err.inspect}"
+ ].join("\n")
+
+ raise CommandError.new(msg).tap { |e|
+ e.set_backtrace err.backtrace
+ }
+ end
+ end
+end
diff --git a/.bundle/gems/pry-0.10.1/lib/pry/output.rb b/.bundle/gems/pry-0.10.1/lib/pry/output.rb
new file mode 100644
index 0000000..b5f6bb3
--- /dev/null
+++ b/.bundle/gems/pry-0.10.1/lib/pry/output.rb
@@ -0,0 +1,50 @@
+class Pry
+ class Output
+ attr_reader :_pry_
+
+ def initialize(_pry_)
+ @_pry_ = _pry_
+ end
+
+ def puts(*objs)
+ return print "\n" if objs.empty?
+
+ objs.each do |obj|
+ if ary = Array.try_convert(obj)
+ puts(*ary)
+ else
+ print "#{obj.to_s.chomp}\n"
+ end
+ end
+
+ nil
+ end
+
+ def print(*objs)
+ objs.each do |obj|
+ _pry_.config.output.print decolorize_maybe(obj.to_s)
+ end
+
+ nil
+ end
+ alias << print
+ alias write print
+
+ # If _pry_.config.color is currently false, removes ansi escapes from the string.
+ def decolorize_maybe(str)
+ if _pry_.config.color
+ str
+ else
+ Helpers::Text.strip_color str
+ end
+ end
+
+ def method_missing(name, *args, &block)
+ _pry_.config.output.send(name, *args, &block)
+ end
+
+ def respond_to_missing?(*a)
+ _pry_.config.respond_to?(*a)
+ end
+ end
+end
diff --git a/.bundle/gems/pry-0.10.1/lib/pry/pager.rb b/.bundle/gems/pry-0.10.1/lib/pry/pager.rb
new file mode 100644
index 0000000..e5451d2
--- /dev/null
+++ b/.bundle/gems/pry-0.10.1/lib/pry/pager.rb
@@ -0,0 +1,236 @@
+require 'pry/terminal'
+
+# A pager is an `IO`-like object that accepts text and either prints it
+# immediately, prints it one page at a time, or streams it to an external
+# program to print one page at a time.
+class Pry::Pager
+ class StopPaging < StandardError
+ end
+
+ attr_reader :_pry_
+
+ def initialize(_pry_)
+ @_pry_ = _pry_
+ end
+
+ # Send the given text through the best available pager (if `Pry.config.pager` is
+ # enabled).
+ # If you want to send text through in chunks as you generate it, use `open` to
+ # get a writable object instead.
+ # @param [String] text A piece of text to run through a pager.
+ # @param [IO] output (`$stdout`) An object to send output to.
+ def page(text)
+ open do |pager|
+ pager << text
+ end
+ end
+
+ # Yields a pager object (`NullPager`, `SimplePager`, or `SystemPager`). All
+ # pagers accept output with `#puts`, `#print`, `#write`, and `#<<`.
+ # @param [IO] output (`$stdout`) An object to send output to.
+ def open
+ pager = best_available
+ yield pager
+ rescue StopPaging
+ ensure
+ pager.close if pager
+ end
+
+ private
+
+ def enabled?; !!@enabled; end
+
+ def output; @output; end
+
+ # Return an instance of the "best" available pager class -- `SystemPager` if
+ # possible, `SimplePager` if `SystemPager` isn't available, and `NullPager`
+ # if the user has disabled paging. All pagers accept output with `#puts`,
+ # `#print`, `#write`, and `#<<`. You must call `#close` when you're done
+ # writing output to a pager, and you must rescue `Pry::Pager::StopPaging`.
+ # These requirements can be avoided by using `.open` instead.
+ # @param [#<<] output ($stdout) An object to send output to.
+ def best_available
+ if !_pry_.config.pager
+ NullPager.new(_pry_.output)
+ elsif !SystemPager.available? || Pry::Helpers::BaseHelpers.jruby?
+ SimplePager.new(_pry_.output)
+ else
+ SystemPager.new(_pry_.output)
+ end
+ end
+
+ # `NullPager` is a "pager" that actually just prints all output as it comes
+ # in. Used when `Pry.config.pager` is false.
+ class NullPager
+ def initialize(out)
+ @out = out
+ end
+
+ def puts(str)
+ print "#{str.chomp}\n"
+ end
+
+ def print(str)
+ write str
+ end
+ alias << print
+
+ def write(str)
+ @out.write str
+ end
+
+ def close
+ end
+
+ private
+
+ def height
+ @height ||= Pry::Terminal.height!
+ end
+
+ def width
+ @width ||= Pry::Terminal.width!
+ end
+ end
+
+ # `SimplePager` is a straightforward pure-Ruby pager. We use it on JRuby and
+ # when we can't find a usable external pager.
+ class SimplePager < NullPager
+ def initialize(*)
+ super
+ @tracker = PageTracker.new(height - 3, width)
+ end
+
+ def write(str)
+ str.lines.each do |line|
+ @out.print line
+ @tracker.record line
+
+ if @tracker.page?
+ @out.print "\n"
+ @out.print "\e[0m"
+ @out.print " --- Press enter to continue " \
+ "( q to break ) --- \n"
+ raise StopPaging if Readline.readline("").chomp == "q"
+ @tracker.reset
+ end
+ end
+ end
+ end
+
+ # `SystemPager` buffers output until we're pretty sure it's at least a page
+ # long, then invokes an external pager and starts streaming output to it. If
+ # `#close` is called before then, it just prints out the buffered content.
+ class SystemPager < NullPager
+ def self.default_pager
+ pager = ENV["PAGER"] || ""
+
+ # Default to less, and make sure less is being passed the correct options
+ if pager.strip.empty? or pager =~ /^less\b/
+ pager = "less -R -F -X"
+ end
+
+ pager
+ end
+
+ def self.available?
+ if @system_pager.nil?
+ @system_pager = begin
+ pager_executable = default_pager.split(' ').first
+ `which #{pager_executable}`
+ $?.success?
+ rescue
+ false
+ end
+ else
+ @system_pager
+ end
+ end
+
+ def initialize(*)
+ super
+ @tracker = PageTracker.new(height, width)
+ @buffer = ""
+ end
+
+ def write(str)
+ if invoked_pager?
+ write_to_pager str
+ else
+ @tracker.record str
+ @buffer << str
+
+ if @tracker.page?
+ write_to_pager @buffer
+ end
+ end
+ rescue Errno::EPIPE
+ raise StopPaging
+ end
+
+ def close
+ if invoked_pager?
+ pager.close
+ else
+ @out.puts @buffer
+ end
+ end
+
+ private
+
+ def write_to_pager(text)
+ pager.write @out.decolorize_maybe(text)
+ end
+
+ def invoked_pager?
+ @pager
+ end
+
+ def pager
+ @pager ||= IO.popen(self.class.default_pager, 'w')
+ end
+ end
+
+ # `PageTracker` tracks output to determine whether it's likely to take up a
+ # whole page. This doesn't need to be super precise, but we can use it for
+ # `SimplePager` and to avoid invoking the system pager unnecessarily.
+ #
+ # One simplifying assumption is that we don't need `#page?` to return `true`
+ # on the basis of an incomplete line. Long lines should be counted as
+ # multiple lines, but we don't have to transition from `false` to `true`
+ # until we see a newline.
+ class PageTracker
+ def initialize(rows, cols)
+ @rows, @cols = rows, cols
+ reset
+ end
+
+ def record(str)
+ str.lines.each do |line|
+ if line.end_with? "\n"
+ @row += ((@col + line_length(line) - 1) / @cols) + 1
+ @col = 0
+ else
+ @col += line_length(line)
+ end
+ end
+ end
+
+ def page?
+ @row >= @rows
+ end
+
+ def reset
+ @row = 0
+ @col = 0
+ end
+
+ private
+
+ # Approximation of the printable length of a given line, without the
+ # newline and without ANSI color codes.
+ def line_length(line)
+ line.chomp.gsub(/\e\[[\d;]*m/, '').length
+ end
+ end
+end
diff --git a/.bundle/gems/pry-0.10.1/lib/pry/plugins.rb b/.bundle/gems/pry-0.10.1/lib/pry/plugins.rb
new file mode 100644
index 0000000..1d05195
--- /dev/null
+++ b/.bundle/gems/pry-0.10.1/lib/pry/plugins.rb
@@ -0,0 +1,103 @@
+class Pry
+ class PluginManager
+ PRY_PLUGIN_PREFIX = /^pry-/
+
+ # Placeholder when no associated gem found, displays warning
+ class NoPlugin
+ def initialize(name)
+ @name = name
+ end
+
+ def method_missing(*args)
+ warn "Warning: The plugin '#{@name}' was not found! (no gem found)"
+ end
+ end
+
+ class Plugin
+ attr_accessor :name, :gem_name, :enabled, :spec, :active
+
+ def initialize(name, gem_name, spec, enabled)
+ @name, @gem_name, @enabled, @spec = name, gem_name, enabled, spec
+ end
+
+ # Disable a plugin. (prevents plugin from being loaded, cannot
+ # disable an already activated plugin)
+ def disable!
+ self.enabled = false
+ end
+
+ # Enable a plugin. (does not load it immediately but puts on
+ # 'white list' to be loaded)
+ def enable!
+ self.enabled = true
+ end
+
+ # Load the Command line options defined by this plugin (if they exist)
+ def load_cli_options
+ cli_options_file = File.join(spec.full_gem_path, "lib/#{spec.name}/cli.rb")
+ require cli_options_file if File.exist?(cli_options_file)
+ end
+ # Activate the plugin (require the gem - enables/loads the
+ # plugin immediately at point of call, even if plugin is
+ # disabled)
+ # Does not reload plugin if it's already active.
+ def activate!
+ # Create the configuration object for the plugin.
+ Pry.config.send("#{gem_name.gsub('-', '_')}=", Pry::Config.from_hash({}))
+
+ begin
+ require gem_name if !active?
+ rescue LoadError => e
+ warn "Found plugin #{gem_name}, but could not require '#{gem_name}'"
+ warn e
+ rescue => e
+ warn "require '#{gem_name}' # Failed, saying: #{e}"
+ end
+
+ self.active = true
+ self.enabled = true
+ end
+
+ alias active? active
+ alias enabled? enabled
+ end
+
+ def initialize
+ @plugins = []
+ end
+
+ # Find all installed Pry plugins and store them in an internal array.
+ def locate_plugins
+ Gem.refresh
+ (Gem::Specification.respond_to?(:each) ? Gem::Specification : Gem.source_index.find_name('')).each do |gem|
+ next if gem.name !~ PRY_PLUGIN_PREFIX
+ plugin_name = gem.name.split('-', 2).last
+ @plugins << Plugin.new(plugin_name, gem.name, gem, true) if !gem_located?(gem.name)
+ end
+ @plugins
+ end
+
+ # @return [Hash] A hash with all plugin names (minus the 'pry-') as
+ # keys and Plugin objects as values.
+ def plugins
+ h = Hash.new { |_, key| NoPlugin.new(key) }
+ @plugins.each do |plugin|
+ h[plugin.name] = plugin
+ end
+ h
+ end
+
+ # Require all enabled plugins, disabled plugins are skipped.
+ def load_plugins
+ @plugins.each do |plugin|
+ plugin.activate! if plugin.enabled?
+ end
+ end
+
+ private
+ def gem_located?(gem_name)
+ @plugins.any? { |plugin| plugin.gem_name == gem_name }
+ end
+ end
+
+end
diff --git a/.bundle/gems/pry-0.10.1/lib/pry/prompt.rb b/.bundle/gems/pry-0.10.1/lib/pry/prompt.rb
new file mode 100644
index 0000000..62f0bc1
--- /dev/null
+++ b/.bundle/gems/pry-0.10.1/lib/pry/prompt.rb
@@ -0,0 +1,26 @@
+class Pry::Prompt
+ MAP = {
+ "default" => {
+ value: Pry::DEFAULT_PROMPT,
+ description: "The default Pry prompt. Includes information about the\n" \
+ "current expression number, evaluation context, and nesting\n" \
+ "level, plus a reminder that you're using Pry."
+ },
+
+ "simple" => {
+ value: Pry::SIMPLE_PROMPT,
+ description: "A simple '>>'."
+ },
+
+ "nav" => {
+ value: Pry::NAV_PROMPT,
+ description: "A prompt that displays the binding stack as a path and\n" \
+ "includes information about _in_ and _out_."
+ },
+
+ "none" => {
+ value: Pry::NO_PROMPT,
+ description: "Wave goodbye to the Pry prompt."
+ }
+ }
+end
diff --git a/.bundle/gems/pry-0.10.1/lib/pry/pry_class.rb b/.bundle/gems/pry-0.10.1/lib/pry/pry_class.rb
new file mode 100644
index 0000000..69f68e4
--- /dev/null
+++ b/.bundle/gems/pry-0.10.1/lib/pry/pry_class.rb
@@ -0,0 +1,375 @@
+require 'pry/config'
+class Pry
+
+ HOME_RC_FILE = ENV["PRYRC"] || "~/.pryrc"
+ LOCAL_RC_FILE = "./.pryrc"
+
+ class << self
+ extend Forwardable
+ attr_accessor :custom_completions
+ attr_accessor :current_line
+ attr_accessor :line_buffer
+ attr_accessor :eval_path
+ attr_accessor :cli
+ attr_accessor :quiet
+ attr_accessor :last_internal_error
+ attr_accessor :config
+ attr_writer :history
+
+ def_delegators :@plugin_manager, :plugins, :load_plugins, :locate_plugins
+
+ extend Pry::Config::Convenience
+ config_shortcut(*Pry::Config.shortcuts)
+
+ def prompt=(value)
+ config.prompt = value
+ end
+
+ def prompt
+ config.prompt
+ end
+
+ def history
+ @history ||= History.new
+ end
+ end
+
+ #
+ # @return [main]
+ # returns the special instance of Object, "main".
+ #
+ def self.main
+ @main ||= TOPLEVEL_BINDING.eval "self"
+ end
+
+ #
+ # @return [Pry::Config]
+ # Returns a value store for an instance of Pry running on the current thread.
+ #
+ def self.current
+ Thread.current[:__pry__] ||= Pry::Config.from_hash({}, nil)
+ end
+
+ # Load the given file in the context of `Pry.toplevel_binding`
+ # @param [String] file The unexpanded file path.
+ def self.load_file_at_toplevel(file)
+ toplevel_binding.eval(File.read(file), file)
+ rescue RescuableException => e
+ puts "Error loading #{file}: #{e}\n#{e.backtrace.first}"
+ end
+
+ # Load HOME_RC_FILE and LOCAL_RC_FILE if appropriate
+ # This method can also be used to reload the files if they have changed.
+ def self.load_rc_files
+ rc_files_to_load.each do |file|
+ critical_section do
+ load_file_at_toplevel(file)
+ end
+ end
+ end
+
+ # Load the local RC file (./.pryrc)
+ def self.rc_files_to_load
+ files = []
+ files << HOME_RC_FILE if Pry.config.should_load_rc
+ files << LOCAL_RC_FILE if Pry.config.should_load_local_rc
+ files.map { |file| real_path_to(file) }.compact.uniq
+ end
+
+ # Expand a file to its canonical name (following symlinks as appropriate)
+ def self.real_path_to(file)
+ expanded = Pathname.new(File.expand_path(file)).realpath.to_s
+ # For rbx 1.9 mode [see rubinius issue #2165]
+ File.exist?(expanded) ? expanded : nil
+ rescue Errno::ENOENT
+ nil
+ end
+
+ # Load any Ruby files specified with the -r flag on the command line.
+ def self.load_requires
+ Pry.config.requires.each do |file|
+ require file
+ end
+ end
+
+ # Trap interrupts on jruby, and make them behave like MRI so we can
+ # catch them.
+ def self.load_traps
+ trap('INT'){ raise Interrupt }
+ end
+
+ def self.load_win32console
+ begin
+ require 'win32console'
+ # The mswin and mingw versions of pry require win32console, so this should
+ # only fail on jruby (where win32console doesn't work).
+ # Instead we'll recommend ansicon, which does.
+ rescue LoadError
+ warn <<-WARNING if Pry.config.windows_console_warning
+For a better Pry experience on Windows, please use ansicon:
+ https://github.com/adoxa/ansicon
+If you use an alternative to ansicon and don't want to see this warning again,
+you can add "Pry.config.windows_console_warning = false" to your .pryrc.
+ WARNING
+ end
+ end
+
+ # Do basic setup for initial session.
+ # Including: loading .pryrc, loading plugins, loading requires, and
+ # loading history.
+ def self.initial_session_setup
+ return unless initial_session?
+ @initial_session = false
+
+ # note these have to be loaded here rather than in pry_instance as
+ # we only want them loaded once per entire Pry lifetime.
+ load_rc_files
+ load_plugins if Pry.config.should_load_plugins
+ load_requires if Pry.config.should_load_requires
+ load_history if Pry.config.history.should_load
+ load_traps if Pry.config.should_trap_interrupts
+ load_win32console if Pry::Helpers::BaseHelpers.windows? && !Pry::Helpers::BaseHelpers.windows_ansi?
+ end
+
+ # Start a Pry REPL.
+ # This method also loads `~/.pryrc` and `./.pryrc` as necessary the
+ # first time it is invoked.
+ # @param [Object, Binding] target The receiver of the Pry session
+ # @param [Hash] options
+ # @option options (see Pry#initialize)
+ # @example
+ # Pry.start(Object.new, :input => MyInput.new)
+ def self.start(target=nil, options={})
+ return if ENV['DISABLE_PRY']
+ options = options.to_hash
+
+ if in_critical_section?
+ output.puts "ERROR: Pry started inside Pry."
+ output.puts "This can happen if you have a binding.pry inside a #to_s or #inspect function."
+ return
+ end
+
+ options[:target] = Pry.binding_for(target || toplevel_binding)
+ options[:hooks] = Pry::Hooks.from_hash options.delete(:hooks) if options.key?(:hooks)
+ initial_session_setup
+
+ # Unless we were given a backtrace, save the current one
+ if options[:backtrace].nil?
+ options[:backtrace] = caller
+
+ # If Pry was started via `binding.pry`, elide that from the backtrace
+ if options[:backtrace].first =~ /pry.*core_extensions.*pry/
+ options[:backtrace].shift
+ end
+ end
+
+ driver = options[:driver] || Pry::REPL
+
+ # Enter the matrix
+ driver.start(options)
+ rescue Pry::TooSafeException
+ puts "ERROR: Pry cannot work with $SAFE > 0"
+ raise
+ end
+
+ # Execute the file through the REPL loop, non-interactively.
+ # @param [String] file_name File name to load through the REPL.
+ def self.load_file_through_repl(file_name)
+ require "pry/repl_file_loader"
+ REPLFileLoader.new(file_name).load
+ end
+
+ #
+ # An inspector that clips the output to `max_length` chars.
+ # In case of > `max_length` chars the `# notation is used.
+ #
+ # @param [Object] obj
+ # The object to view.
+ #
+ # @param [Hash] options
+ # @option options [Integer] :max_length (60)
+ # The maximum number of chars before clipping occurs.
+ #
+ # @option options [Boolean] :id (false)
+ # Boolean to indicate whether or not a hex reprsentation of the object ID
+ # is attached to the return value when the length of inspect is greater than
+ # value of `:max_length`.
+ #
+ # @return [String]
+ # The string representation of `obj`.
+ #
+ def self.view_clip(obj, options = {})
+ max = options.fetch :max_length, 60
+ id = options.fetch :id, false
+ if obj.kind_of?(Module) && obj.name.to_s != "" && obj.name.to_s.length <= max
+ obj.name.to_s
+ elsif Pry.main == obj
+ # special-case to support jruby.
+ # fixed as of https://github.com/jruby/jruby/commit/d365ebd309cf9df3dde28f5eb36ea97056e0c039
+ # we can drop in the future.
+ obj.to_s
+ elsif Pry.config.prompt_safe_objects.any? { |v| v === obj } && obj.inspect.length <= max
+ obj.inspect
+ else
+ id == true ? "#<#{obj.class}:0x%x>" % (obj.object_id << 1) : "#<#{obj.class}>"
+ end
+ rescue RescuableException
+ "unknown"
+ end
+
+ # Load Readline history if required.
+ def self.load_history
+ Pry.history.load
+ end
+
+ # @return [Boolean] Whether this is the first time a Pry session has
+ # been started since loading the Pry class.
+ def self.initial_session?
+ @initial_session
+ end
+
+ # Run a Pry command from outside a session. The commands available are
+ # those referenced by `Pry.config.commands` (the default command set).
+ # @param [String] command_string The Pry command (including arguments,
+ # if any).
+ # @param [Hash] options Optional named parameters.
+ # @return [Object] The return value of the Pry command.
+ # @option options [Object, Binding] :target The object to run the
+ # command under. Defaults to `TOPLEVEL_BINDING` (main).
+ # @option options [Boolean] :show_output Whether to show command
+ # output. Defaults to true.
+ # @example Run at top-level with no output.
+ # Pry.run_command "ls"
+ # @example Run under Pry class, returning only public methods.
+ # Pry.run_command "ls -m", :target => Pry
+ # @example Display command output.
+ # Pry.run_command "ls -av", :show_output => true
+ def self.run_command(command_string, options={})
+ options = {
+ :target => TOPLEVEL_BINDING,
+ :show_output => true,
+ :output => Pry.config.output,
+ :commands => Pry.config.commands
+ }.merge!(options)
+
+ # :context for compatibility with <= 0.9.11.4
+ target = options[:context] || options[:target]
+ output = options[:show_output] ? options[:output] : StringIO.new
+
+ pry = Pry.new(:output => output, :target => target, :commands => options[:commands])
+ pry.eval command_string
+ end
+
+ def self.default_editor_for_platform
+ return ENV['VISUAL'] if ENV['VISUAL'] and not ENV['VISUAL'].empty?
+ return ENV['EDITOR'] if ENV['EDITOR'] and not ENV['EDITOR'].empty?
+ if Helpers::BaseHelpers.windows?
+ 'notepad'
+ else
+ %w(editor nano vi).detect do |editor|
+ system("which #{editor} > /dev/null 2>&1")
+ end
+ end
+ end
+
+ def self.auto_resize!
+ Pry.config.input # by default, load Readline
+
+ if !defined?(Readline) || Pry.config.input != Readline
+ warn "Sorry, you must be using Readline for Pry.auto_resize! to work."
+ return
+ end
+
+ if Readline::VERSION =~ /edit/i
+ warn <<-EOT
+Readline version #{Readline::VERSION} detected - will not auto_resize! correctly.
+ For the fix, use GNU Readline instead:
+ https://github.com/guard/guard/wiki/Add-proper-Readline-support-to-Ruby-on-Mac-OS-X
+ EOT
+ return
+ end
+
+ trap :WINCH do
+ begin
+ Readline.set_screen_size(*Terminal.size!)
+ rescue => e
+ warn "\nPry.auto_resize!'s Readline.set_screen_size failed: #{e}"
+ end
+ begin
+ Readline.refresh_line
+ rescue => e
+ warn "\nPry.auto_resize!'s Readline.refresh_line failed: #{e}"
+ end
+ end
+ end
+
+ # Set all the configurable options back to their default values
+ def self.reset_defaults
+ @initial_session = true
+ self.config = Pry::Config.new Pry::Config::Default.new
+ self.cli = false
+ self.current_line = 1
+ self.line_buffer = [""]
+ self.eval_path = "(pry)"
+ end
+
+ # Basic initialization.
+ def self.init
+ @plugin_manager ||= PluginManager.new
+ reset_defaults
+ locate_plugins
+ end
+
+ # Return a `Binding` object for `target` or return `target` if it is
+ # already a `Binding`.
+ # In the case where `target` is top-level then return `TOPLEVEL_BINDING`
+ # @param [Object] target The object to get a `Binding` object for.
+ # @return [Binding] The `Binding` object.
+ def self.binding_for(target)
+ if Binding === target
+ target
+ else
+ if Pry.main == target
+ TOPLEVEL_BINDING
+ else
+ target.__binding__
+ end
+ end
+ end
+
+ def self.toplevel_binding
+ unless defined?(@toplevel_binding) && @toplevel_binding
+ # Grab a copy of the TOPLEVEL_BINDING without any local variables.
+ # This binding has a default definee of Object, and new methods are
+ # private (just as in TOPLEVEL_BINDING).
+ TOPLEVEL_BINDING.eval <<-RUBY
+ def self.__pry__
+ binding
+ end
+ Pry.toplevel_binding = __pry__
+ class << self; undef __pry__; end
+ RUBY
+ end
+ @toplevel_binding.eval('private')
+ @toplevel_binding
+ end
+
+ def self.toplevel_binding=(binding)
+ @toplevel_binding = binding
+ end
+
+ def self.in_critical_section?
+ Thread.current[:pry_critical_section] ||= 0
+ Thread.current[:pry_critical_section] > 0
+ end
+
+ def self.critical_section(&block)
+ Thread.current[:pry_critical_section] ||= 0
+ Thread.current[:pry_critical_section] += 1
+ yield
+ ensure
+ Thread.current[:pry_critical_section] -= 1
+ end
+end
+
+Pry.init
diff --git a/.bundle/gems/pry-0.10.1/lib/pry/pry_instance.rb b/.bundle/gems/pry-0.10.1/lib/pry/pry_instance.rb
new file mode 100644
index 0000000..0877ab2
--- /dev/null
+++ b/.bundle/gems/pry-0.10.1/lib/pry/pry_instance.rb
@@ -0,0 +1,664 @@
+# -*- coding: utf-8 -*-
+##
+# Pry is a powerful alternative to the standard IRB shell for Ruby. It
+# features syntax highlighting, a flexible plugin architecture, runtime
+# invocation and source and documentation browsing.
+#
+# Pry can be started similar to other command line utilities by simply running
+# the following command:
+#
+# pry
+#
+# Once inside Pry you can invoke the help message:
+#
+# help
+#
+# This will show a list of available commands and their usage. For more
+# information about Pry you can refer to the following resources:
+#
+# * http://pry.github.com/
+# * https://github.com/pry/pry
+# * the IRC channel, which is #pry on the Freenode network
+#
+
+class Pry
+ attr_accessor :binding_stack
+ attr_accessor :custom_completions
+ attr_accessor :eval_string
+ attr_accessor :backtrace
+ attr_accessor :suppress_output
+ attr_accessor :last_result
+ attr_accessor :last_file
+ attr_accessor :last_dir
+
+ attr_reader :last_exception
+ attr_reader :command_state
+ attr_reader :exit_value
+ attr_reader :input_array
+ attr_reader :output_array
+ attr_reader :config
+
+ extend Pry::Config::Convenience
+ config_shortcut(*Pry::Config.shortcuts)
+ EMPTY_COMPLETIONS = [].freeze
+
+ # Create a new {Pry} instance.
+ # @param [Hash] options
+ # @option options [#readline] :input
+ # The object to use for input.
+ # @option options [#puts] :output
+ # The object to use for output.
+ # @option options [Pry::CommandBase] :commands
+ # The object to use for commands.
+ # @option options [Hash] :hooks
+ # The defined hook Procs.
+ # @option options [Array] :prompt
+ # The array of Procs to use for prompts.
+ # @option options [Proc] :print
+ # The Proc to use for printing return values.
+ # @option options [Boolean] :quiet
+ # Omit the `whereami` banner when starting.
+ # @option options [Array] :backtrace
+ # The backtrace of the session's `binding.pry` line, if applicable.
+ # @option options [Object] :target
+ # The initial context for this session.
+ def initialize(options={})
+ @binding_stack = []
+ @indent = Pry::Indent.new
+ @command_state = {}
+ @eval_string = ""
+ @backtrace = options.delete(:backtrace) || caller
+ target = options.delete(:target)
+ @config = Pry::Config.new
+ config.merge!(options)
+ push_prompt(config.prompt)
+ @input_array = Pry::HistoryArray.new config.memory_size
+ @output_array = Pry::HistoryArray.new config.memory_size
+ @custom_completions = config.command_completions
+ set_last_result nil
+ @input_array << nil
+ push_initial_binding(target)
+ exec_hook(:when_started, target, options, self)
+ end
+
+ # The current prompt.
+ # This is the prompt at the top of the prompt stack.
+ #
+ # @example
+ # self.prompt = Pry::SIMPLE_PROMPT
+ # self.prompt # => Pry::SIMPLE_PROMPT
+ #
+ # @return [Array] Current prompt.
+ def prompt
+ prompt_stack.last
+ end
+
+ def prompt=(new_prompt)
+ if prompt_stack.empty?
+ push_prompt new_prompt
+ else
+ prompt_stack[-1] = new_prompt
+ end
+ end
+
+ # Initialize this instance by pushing its initial context into the binding
+ # stack. If no target is given, start at the top level.
+ def push_initial_binding(target=nil)
+ push_binding(target || Pry.toplevel_binding)
+ end
+
+ # The currently active `Binding`.
+ # @return [Binding] The currently active `Binding` for the session.
+ def current_binding
+ binding_stack.last
+ end
+ alias current_context current_binding # support previous API
+
+ # Push a binding for the given object onto the stack. If this instance is
+ # currently stopped, mark it as usable again.
+ def push_binding(object)
+ @stopped = false
+ binding_stack << Pry.binding_for(object)
+ end
+
+ #
+ # Generate completions.
+ #
+ # @param [String] input
+ # What the user has typed so far
+ #
+ # @return [Array]
+ # Possible completions
+ #
+ def complete(str)
+ return EMPTY_COMPLETIONS unless config.completer
+ Pry.critical_section do
+ completer = config.completer.new(config.input, self)
+ completer.call str, target: current_binding, custom_completions: custom_completions.call.push(*sticky_locals.keys)
+ end
+ end
+
+ #
+ # Injects a local variable into the provided binding.
+ #
+ # @param [String] name
+ # The name of the local to inject.
+ #
+ # @param [Object] value
+ # The value to set the local to.
+ #
+ # @param [Binding] b
+ # The binding to set the local on.
+ #
+ # @return [Object]
+ # The value the local was set to.
+ #
+ def inject_local(name, value, b)
+ value = Proc === value ? value.call : value
+ if b.respond_to?(:local_variable_set)
+ b.local_variable_set name, value
+ else # < 2.1
+ begin
+ Pry.current[:pry_local] = value
+ b.eval "#{name} = ::Pry.current[:pry_local]"
+ ensure
+ Pry.current[:pry_local] = nil
+ end
+ end
+ end
+
+ undef :memory_size if method_defined? :memory_size
+ # @return [Integer] The maximum amount of objects remembered by the inp and
+ # out arrays. Defaults to 100.
+ def memory_size
+ @output_array.max_size
+ end
+
+ undef :memory_size= if method_defined? :memory_size=
+ def memory_size=(size)
+ @input_array = Pry::HistoryArray.new(size)
+ @output_array = Pry::HistoryArray.new(size)
+ end
+
+ # Inject all the sticky locals into the current binding.
+ def inject_sticky_locals!
+ sticky_locals.each_pair do |name, value|
+ inject_local(name, value, current_binding)
+ end
+ end
+
+ # Add a sticky local to this Pry instance.
+ # A sticky local is a local that persists between all bindings in a session.
+ # @param [Symbol] name The name of the sticky local.
+ # @yield The block that defines the content of the local. The local
+ # will be refreshed at each tick of the repl loop.
+ def add_sticky_local(name, &block)
+ config.extra_sticky_locals[name] = block
+ end
+
+ def sticky_locals
+ { _in_: input_array,
+ _out_: output_array,
+ _pry_: self,
+ _ex_: last_exception && last_exception.wrapped_exception,
+ _file_: last_file,
+ _dir_: last_dir,
+ _: proc { last_result },
+ __: proc { output_array[-2] }
+ }.merge(config.extra_sticky_locals)
+ end
+
+ # Reset the current eval string. If the user has entered part of a multiline
+ # expression, this discards that input.
+ def reset_eval_string
+ @eval_string = ""
+ end
+
+ # Pass a line of input to Pry.
+ #
+ # This is the equivalent of `Binding#eval` but with extra Pry!
+ #
+ # In particular:
+ # 1. Pry commands will be executed immediately if the line matches.
+ # 2. Partial lines of input will be queued up until a complete expression has
+ # been accepted.
+ # 3. Output is written to `#output` in pretty colours, not returned.
+ #
+ # Once this method has raised an exception or returned false, this instance
+ # is no longer usable. {#exit_value} will return the session's breakout
+ # value if applicable.
+ #
+ # @param [String?] line The line of input; `nil` if the user types ``
+ # @option options [Boolean] :generated Whether this line was generated automatically.
+ # Generated lines are not stored in history.
+ # @return [Boolean] Is Pry ready to accept more input?
+ # @raise [Exception] If the user uses the `raise-up` command, this method
+ # will raise that exception.
+ def eval(line, options={})
+ return false if @stopped
+
+ exit_value = nil
+ exception = catch(:raise_up) do
+ exit_value = catch(:breakout) do
+ handle_line(line, options)
+ # We use 'return !@stopped' here instead of 'return true' so that if
+ # handle_line has stopped this pry instance (e.g. by opening _pry_.repl and
+ # then popping all the bindings) we still exit immediately.
+ return !@stopped
+ end
+ exception = false
+ end
+
+ @stopped = true
+ @exit_value = exit_value
+
+ # TODO: make this configurable?
+ raise exception if exception
+ return false
+ end
+
+ def handle_line(line, options)
+ if line.nil?
+ config.control_d_handler.call(@eval_string, self)
+ return
+ end
+
+ ensure_correct_encoding!(line)
+ Pry.history << line unless options[:generated]
+
+ @suppress_output = false
+ inject_sticky_locals!
+ begin
+ if !process_command_safely(line.lstrip)
+ @eval_string << "#{line.chomp}\n" if !line.empty? || !@eval_string.empty?
+ end
+ rescue RescuableException => e
+ self.last_exception = e
+ result = e
+
+ Pry.critical_section do
+ show_result(result)
+ end
+ return
+ end
+
+ # This hook is supposed to be executed after each line of ruby code
+ # has been read (regardless of whether eval_string is yet a complete expression)
+ exec_hook :after_read, eval_string, self
+
+ begin
+ complete_expr = Pry::Code.complete_expression?(@eval_string)
+ rescue SyntaxError => e
+ output.puts "SyntaxError: #{e.message.sub(/.*syntax error, */m, '')}"
+ reset_eval_string
+ end
+
+ if complete_expr
+ if @eval_string =~ /;\Z/ || @eval_string.empty? || @eval_string =~ /\A *#.*\n\z/
+ @suppress_output = true
+ end
+
+ # A bug in jruby makes java.lang.Exception not rescued by
+ # `rescue Pry::RescuableException` clause.
+ #
+ # * https://github.com/pry/pry/issues/854
+ # * https://jira.codehaus.org/browse/JRUBY-7100
+ #
+ # Until that gets fixed upstream, treat java.lang.Exception
+ # as an additional exception to be rescued explicitly.
+ #
+ # This workaround has a side effect: java exceptions specified
+ # in `Pry.config.exception_whitelist` are ignored.
+ jruby_exceptions = []
+ if Pry::Helpers::BaseHelpers.jruby?
+ jruby_exceptions << Java::JavaLang::Exception
+ end
+
+ begin
+ # Reset eval string, in case we're evaluating Ruby that does something
+ # like open a nested REPL on this instance.
+ eval_string = @eval_string
+ reset_eval_string
+
+ result = evaluate_ruby(eval_string)
+ rescue RescuableException, *jruby_exceptions => e
+ # Eliminate following warning:
+ # warning: singleton on non-persistent Java type X
+ # (http://wiki.jruby.org/Persistence)
+ if Pry::Helpers::BaseHelpers.jruby? && e.class.respond_to?('__persistent__')
+ e.class.__persistent__ = true
+ end
+ self.last_exception = e
+ result = e
+ end
+
+ Pry.critical_section do
+ show_result(result)
+ end
+ end
+
+ throw(:breakout) if current_binding.nil?
+ end
+ private :handle_line
+
+ # Potentially deprecated — Use `Pry::REPL.new(pry, :target => target).start`
+ # (If nested sessions are going to exist, this method is fine, but a goal is
+ # to come up with an alternative to nested sessions altogether.)
+ def repl(target = nil)
+ Pry::REPL.new(self, :target => target).start
+ end
+
+ def evaluate_ruby(code)
+ inject_sticky_locals!
+ exec_hook :before_eval, code, self
+
+ result = current_binding.eval(code, Pry.eval_path, Pry.current_line)
+ set_last_result(result, code)
+ ensure
+ update_input_history(code)
+ exec_hook :after_eval, result, self
+ end
+
+ # Output the result or pass to an exception handler (if result is an exception).
+ def show_result(result)
+ if last_result_is_exception?
+ exception_handler.call(output, result, self)
+ elsif should_print?
+ print.call(output, result, self)
+ else
+ # nothin'
+ end
+ rescue RescuableException => e
+ # Being uber-paranoid here, given that this exception arose because we couldn't
+ # serialize something in the user's program, let's not assume we can serialize
+ # the exception either.
+ begin
+ output.puts "(pry) output error: #{e.inspect}"
+ rescue RescuableException => e
+ if last_result_is_exception?
+ output.puts "(pry) output error: failed to show exception"
+ else
+ output.puts "(pry) output error: failed to show result"
+ end
+ end
+ ensure
+ output.flush if output.respond_to?(:flush)
+ end
+
+ # Force `eval_string` into the encoding of `val`. [Issue #284]
+ def ensure_correct_encoding!(val)
+ if @eval_string.empty? &&
+ val.respond_to?(:encoding) &&
+ val.encoding != @eval_string.encoding
+ @eval_string.force_encoding(val.encoding)
+ end
+ end
+ private :ensure_correct_encoding!
+
+ # If the given line is a valid command, process it in the context of the
+ # current `eval_string` and binding.
+ # @param [String] val The line to process.
+ # @return [Boolean] `true` if `val` is a command, `false` otherwise
+ def process_command(val)
+ val = val.chomp
+ result = commands.process_line(val,
+ :target => current_binding,
+ :output => output,
+ :eval_string => @eval_string,
+ :pry_instance => self
+ )
+
+ # set a temporary (just so we can inject the value we want into eval_string)
+ Pry.current[:pry_cmd_result] = result
+
+ # note that `result` wraps the result of command processing; if a
+ # command was matched and invoked then `result.command?` returns true,
+ # otherwise it returns false.
+ if result.command?
+ if !result.void_command?
+ # the command that was invoked was non-void (had a return value) and so we make
+ # the value of the current expression equal to the return value
+ # of the command.
+ @eval_string.replace "::Pry.current[:pry_cmd_result].retval\n"
+ end
+ true
+ else
+ false
+ end
+ end
+
+ # Same as process_command, but outputs exceptions to `#output` instead of
+ # raising.
+ # @param [String] val The line to process.
+ # @return [Boolean] `true` if `val` is a command, `false` otherwise
+ def process_command_safely(val)
+ process_command(val)
+ rescue CommandError, Slop::InvalidOptionError, MethodSource::SourceNotFoundError => e
+ Pry.last_internal_error = e
+ output.puts "Error: #{e.message}"
+ true
+ end
+
+ # Run the specified command.
+ # @param [String] val The command (and its params) to execute.
+ # @return [Pry::Command::VOID_VALUE]
+ # @example
+ # pry_instance.run_command("ls -m")
+ def run_command(val)
+ commands.process_line(val,
+ :eval_string => @eval_string,
+ :target => current_binding,
+ :pry_instance => self,
+ :output => output
+ )
+ Pry::Command::VOID_VALUE
+ end
+
+ # Execute the specified hook.
+ # @param [Symbol] name The hook name to execute
+ # @param [*Object] args The arguments to pass to the hook
+ # @return [Object, Exception] The return value of the hook or the exception raised
+ #
+ # If executing a hook raises an exception, we log that and then continue sucessfully.
+ # To debug such errors, use the global variable $pry_hook_error, which is set as a
+ # result.
+ def exec_hook(name, *args, &block)
+ e_before = hooks.errors.size
+ hooks.exec_hook(name, *args, &block).tap do
+ hooks.errors[e_before..-1].each do |e|
+ output.puts "#{name} hook failed: #{e.class}: #{e.message}"
+ output.puts "#{e.backtrace.first}"
+ output.puts "(see _pry_.hooks.errors to debug)"
+ end
+ end
+ end
+
+ # Set the last result of an eval.
+ # This method should not need to be invoked directly.
+ # @param [Object] result The result.
+ # @param [String] code The code that was run.
+ def set_last_result(result, code="")
+ @last_result_is_exception = false
+ @output_array << result
+
+ self.last_result = result unless code =~ /\A\s*\z/
+ end
+
+ #
+ # Set the last exception for a session.
+ #
+ # @param [Exception] e
+ # the last exception.
+ #
+ def last_exception=(e)
+ last_exception = Pry::LastException.new(e)
+ @last_result_is_exception = true
+ @output_array << last_exception
+ @last_exception = last_exception
+ end
+
+ # Update Pry's internal state after evalling code.
+ # This method should not need to be invoked directly.
+ # @param [String] code The code we just eval'd
+ def update_input_history(code)
+ # Always push to the @input_array as the @output_array is always pushed to.
+ @input_array << code
+ if code
+ Pry.line_buffer.push(*code.each_line)
+ Pry.current_line += code.lines.count
+ end
+ end
+
+ # @return [Boolean] True if the last result is an exception that was raised,
+ # as opposed to simply an instance of Exception (like the result of
+ # Exception.new)
+ def last_result_is_exception?
+ @last_result_is_exception
+ end
+
+ # Whether the print proc should be invoked.
+ # Currently only invoked if the output is not suppressed.
+ # @return [Boolean] Whether the print proc should be invoked.
+ def should_print?
+ !@suppress_output
+ end
+
+ # Returns the appropriate prompt to use.
+ # @return [String] The prompt.
+ def select_prompt
+ object = current_binding.eval('self')
+
+ open_token = @indent.open_delimiters.any? ? @indent.open_delimiters.last :
+ @indent.stack.last
+
+ c = Pry::Config.from_hash({
+ :object => object,
+ :nesting_level => binding_stack.size - 1,
+ :open_token => open_token,
+ :session_line => Pry.history.session_line_count + 1,
+ :history_line => Pry.history.history_line_count + 1,
+ :expr_number => input_array.count,
+ :_pry_ => self,
+ :binding_stack => binding_stack,
+ :input_array => input_array,
+ :eval_string => @eval_string,
+ :cont => !@eval_string.empty?})
+
+ Pry.critical_section do
+ # If input buffer is empty then use normal prompt
+ if eval_string.empty?
+ generate_prompt(Array(prompt).first, c)
+
+ # Otherwise use the wait prompt (indicating multi-line expression)
+ else
+ generate_prompt(Array(prompt).last, c)
+ end
+ end
+ end
+
+ def generate_prompt(prompt_proc, conf)
+ if prompt_proc.arity == 1
+ prompt_proc.call(conf)
+ else
+ prompt_proc.call(conf.object, conf.nesting_level, conf._pry_)
+ end
+ end
+ private :generate_prompt
+
+ # the array that the prompt stack is stored in
+ def prompt_stack
+ @prompt_stack ||= Array.new
+ end
+ private :prompt_stack
+
+ # Pushes the current prompt onto a stack that it can be restored from later.
+ # Use this if you wish to temporarily change the prompt.
+ # @param [Array] new_prompt
+ # @return [Array] new_prompt
+ # @example
+ # new_prompt = [ proc { '>' }, proc { '>>' } ]
+ # push_prompt(new_prompt) # => new_prompt
+ def push_prompt(new_prompt)
+ prompt_stack.push new_prompt
+ end
+
+ # Pops the current prompt off of the prompt stack.
+ # If the prompt you are popping is the last prompt, it will not be popped.
+ # Use this to restore the previous prompt.
+ # @return [Array] Prompt being popped.
+ # @example
+ # prompt1 = [ proc { '>' }, proc { '>>' } ]
+ # prompt2 = [ proc { '$' }, proc { '>' } ]
+ # pry = Pry.new :prompt => prompt1
+ # pry.push_prompt(prompt2)
+ # pry.pop_prompt # => prompt2
+ # pry.pop_prompt # => prompt1
+ # pry.pop_prompt # => prompt1
+ def pop_prompt
+ prompt_stack.size > 1 ? prompt_stack.pop : prompt
+ end
+
+ undef :pager if method_defined? :pager
+ # Returns the currently configured pager
+ # @example
+ # _pry_.pager.page text
+ def pager
+ Pry::Pager.new(self)
+ end
+
+ undef :output if method_defined? :output
+ # Returns an output device
+ # @example
+ # _pry_.output.puts "ohai!"
+ def output
+ Pry::Output.new(self)
+ end
+
+ # Raise an exception out of Pry.
+ #
+ # See Kernel#raise for documentation of parameters.
+ # See rb_make_exception for the inbuilt implementation.
+ #
+ # This is necessary so that the raise-up command can tell the
+ # difference between an exception the user has decided to raise,
+ # and a mistake in specifying that exception.
+ #
+ # (i.e. raise-up RunThymeError.new should not be the same as
+ # raise-up NameError, "unititialized constant RunThymeError")
+ #
+ def raise_up_common(force, *args)
+ exception = if args == []
+ last_exception || RuntimeError.new
+ elsif args.length == 1 && args.first.is_a?(String)
+ RuntimeError.new(args.first)
+ elsif args.length > 3
+ raise ArgumentError, "wrong number of arguments"
+ elsif !args.first.respond_to?(:exception)
+ raise TypeError, "exception class/object expected"
+ elsif args.length === 1
+ args.first.exception
+ else
+ args.first.exception(args[1])
+ end
+
+ raise TypeError, "exception object expected" unless exception.is_a? Exception
+
+ exception.set_backtrace(args.length === 3 ? args[2] : caller(1))
+
+ if force || binding_stack.one?
+ binding_stack.clear
+ throw :raise_up, exception
+ else
+ binding_stack.pop
+ raise exception
+ end
+ end
+ def raise_up(*args); raise_up_common(false, *args); end
+ def raise_up!(*args); raise_up_common(true, *args); end
+
+ # Convenience accessor for the `quiet` config key.
+ # @return [Boolean]
+ def quiet?
+ config.quiet
+ end
+end
diff --git a/.bundle/gems/pry-0.10.1/lib/pry/rbx_path.rb b/.bundle/gems/pry-0.10.1/lib/pry/rbx_path.rb
new file mode 100644
index 0000000..bd969c6
--- /dev/null
+++ b/.bundle/gems/pry-0.10.1/lib/pry/rbx_path.rb
@@ -0,0 +1,22 @@
+class Pry
+ module RbxPath
+ module_function
+ def is_core_path?(path)
+ Pry::Helpers::BaseHelpers.rbx? && (path.start_with?("kernel") || path.start_with?("lib")) && File.exist?(convert_path_to_full(path))
+ end
+
+ def convert_path_to_full(path)
+ if path.start_with?("kernel")
+ File.join File.dirname(Rubinius::KERNEL_PATH), path
+ elsif path.start_with?("lib")
+ File.join File.dirname(Rubinius::LIB_PATH), path
+ else
+ path
+ end
+ end
+
+ def rvm_ruby?(path)
+ !!(path =~ /\.rvm/)
+ end
+ end
+end
diff --git a/.bundle/gems/pry-0.10.1/lib/pry/repl.rb b/.bundle/gems/pry-0.10.1/lib/pry/repl.rb
new file mode 100644
index 0000000..4748785
--- /dev/null
+++ b/.bundle/gems/pry-0.10.1/lib/pry/repl.rb
@@ -0,0 +1,202 @@
+require 'forwardable'
+
+class Pry
+ class REPL
+ extend Forwardable
+ def_delegators :@pry, :input, :output
+
+ # @return [Pry] The instance of {Pry} that the user is controlling.
+ attr_accessor :pry
+
+ # Instantiate a new {Pry} instance with the given options, then start a
+ # {REPL} instance wrapping it.
+ # @option options See {Pry#initialize}
+ def self.start(options)
+ new(Pry.new(options)).start
+ end
+
+ # Create an instance of {REPL} wrapping the given {Pry}.
+ # @param [Pry] pry The instance of {Pry} that this {REPL} will control.
+ # @param [Hash] options Options for this {REPL} instance.
+ # @option options [Object] :target The initial target of the session.
+ def initialize(pry, options = {})
+ @pry = pry
+ @indent = Pry::Indent.new
+
+ if options[:target]
+ @pry.push_binding options[:target]
+ end
+ end
+
+ # Start the read-eval-print loop.
+ # @return [Object?] If the session throws `:breakout`, return the value
+ # thrown with it.
+ # @raise [Exception] If the session throws `:raise_up`, raise the exception
+ # thrown with it.
+ def start
+ prologue
+ Pry::InputLock.for(:all).with_ownership { repl }
+ ensure
+ epilogue
+ end
+
+ private
+
+ # Set up the repl session.
+ # @return [void]
+ def prologue
+ pry.exec_hook :before_session, pry.output, pry.current_binding, pry
+
+ # Clear the line before starting Pry. This fixes issue #566.
+ if pry.config.correct_indent
+ Kernel.print Pry::Helpers::BaseHelpers.windows_ansi? ? "\e[0F" : "\e[0G"
+ end
+ end
+
+ # The actual read-eval-print loop.
+ #
+ # The {REPL} instance is responsible for reading and looping, whereas the
+ # {Pry} instance is responsible for evaluating user input and printing
+ # return values and command output.
+ #
+ # @return [Object?] If the session throws `:breakout`, return the value
+ # thrown with it.
+ # @raise [Exception] If the session throws `:raise_up`, raise the exception
+ # thrown with it.
+ def repl
+ loop do
+ case val = read
+ when :control_c
+ output.puts ""
+ pry.reset_eval_string
+ when :no_more_input
+ output.puts "" if output.tty?
+ break
+ else
+ output.puts "" if val.nil? && output.tty?
+ return pry.exit_value unless pry.eval(val)
+ end
+ end
+ end
+
+ # Clean up after the repl session.
+ # @return [void]
+ def epilogue
+ pry.exec_hook :after_session, pry.output, pry.current_binding, pry
+ end
+
+ # Read a line of input from the user.
+ # @return [String] The line entered by the user.
+ # @return [nil] On ``.
+ # @return [:control_c] On ``.
+ # @return [:no_more_input] On EOF.
+ def read
+ @indent.reset if pry.eval_string.empty?
+ current_prompt = pry.select_prompt
+ indentation = pry.config.auto_indent ? @indent.current_prefix : ''
+
+ val = read_line("#{current_prompt}#{indentation}")
+
+ # Return nil for EOF, :no_more_input for error, or :control_c for
+ return val unless String === val
+
+ if pry.config.auto_indent
+ original_val = "#{indentation}#{val}"
+ indented_val = @indent.indent(val)
+
+ if output.tty? && pry.config.correct_indent && Pry::Helpers::BaseHelpers.use_ansi_codes?
+ output.print @indent.correct_indentation(
+ current_prompt, indented_val,
+ original_val.length - indented_val.length
+ )
+ output.flush
+ end
+ else
+ indented_val = val
+ end
+
+ indented_val
+ end
+
+ # Manage switching of input objects on encountering `EOFError`s.
+ # @return [Object] Whatever the given block returns.
+ # @return [:no_more_input] Indicates that no more input can be read.
+ def handle_read_errors
+ should_retry = true
+ exception_count = 0
+
+ begin
+ yield
+ rescue EOFError
+ pry.config.input = Pry.config.input
+ if !should_retry
+ output.puts "Error: Pry ran out of things to read from! " \
+ "Attempting to break out of REPL."
+ return :no_more_input
+ end
+ should_retry = false
+ retry
+
+ # Handle like Bash: empty the current input buffer, but don't
+ # quit. This is only for MRI 1.9; other versions of Ruby don't let you
+ # send Interrupt from within Readline.
+ rescue Interrupt
+ return :control_c
+
+ # If we get a random error when trying to read a line we don't want to
+ # automatically retry, as the user will see a lot of error messages
+ # scroll past and be unable to do anything about it.
+ rescue RescuableException => e
+ puts "Error: #{e.message}"
+ output.puts e.backtrace
+ exception_count += 1
+ if exception_count < 5
+ retry
+ end
+ puts "FATAL: Pry failed to get user input using `#{input}`."
+ puts "To fix this you may be able to pass input and output file " \
+ "descriptors to pry directly. e.g."
+ puts " Pry.config.input = STDIN"
+ puts " Pry.config.output = STDOUT"
+ puts " binding.pry"
+ return :no_more_input
+ end
+ end
+
+ # Returns the next line of input to be sent to the {Pry} instance.
+ # @param [String] current_prompt The prompt to use for input.
+ # @return [String?] The next line of input, or `nil` on .
+ def read_line(current_prompt)
+ handle_read_errors do
+ if defined? Coolline and input.is_a? Coolline
+ input.completion_proc = proc do |cool|
+ completions = @pry.complete cool.completed_word
+ completions.compact
+ end
+ elsif input.respond_to? :completion_proc=
+ input.completion_proc = proc do |input|
+ @pry.complete input
+ end
+ end
+
+ if defined?(Readline) and input == Readline
+ input_readline(current_prompt, false) # false since we'll add it manually
+ elsif defined? Coolline and input.is_a? Coolline
+ input_readline(current_prompt)
+ else
+ if input.method(:readline).arity == 1
+ input_readline(current_prompt)
+ else
+ input_readline
+ end
+ end
+ end
+ end
+
+ def input_readline(*args)
+ Pry::InputLock.for(:all).interruptible_region do
+ input.readline(*args)
+ end
+ end
+ end
+end
diff --git a/.bundle/gems/pry-0.10.1/lib/pry/repl_file_loader.rb b/.bundle/gems/pry-0.10.1/lib/pry/repl_file_loader.rb
new file mode 100644
index 0000000..cd8de9a
--- /dev/null
+++ b/.bundle/gems/pry-0.10.1/lib/pry/repl_file_loader.rb
@@ -0,0 +1,74 @@
+class Pry
+
+ # A class to manage the loading of files through the REPL loop.
+ # This is an interesting trick as it processes your file as if it
+ # was user input in an interactive session. As a result, all Pry
+ # commands are available, and they are executed non-interactively. Furthermore
+ # the session becomes interactive when the repl loop processes a
+ # 'make-interactive' command in the file. The session also becomes
+ # interactive when an exception is encountered, enabling you to fix
+ # the error before returning to non-interactive processing with the
+ # 'make-non-interactive' command.
+
+ class REPLFileLoader
+ def initialize(file_name)
+ full_name = File.expand_path(file_name)
+ raise RuntimeError, "No such file: #{full_name}" if !File.exists?(full_name)
+
+ define_additional_commands
+ @content = File.read(full_name)
+ end
+
+ # Switch to interactive mode, i.e take input from the user
+ # and use the regular print and exception handlers.
+ # @param [Pry] _pry_ the Pry instance to make interactive.
+ def interactive_mode(_pry_)
+ _pry_.config.input = Pry.config.input
+ _pry_.config.print = Pry.config.print
+ _pry_.config.exception_handler = Pry.config.exception_handler
+ Pry::REPL.new(_pry_).start
+ end
+
+ # Switch to non-interactive mode. Essentially
+ # this means there is no result output
+ # and that the session becomes interactive when an exception is encountered.
+ # @param [Pry] _pry_ the Pry instance to make non-interactive.
+ def non_interactive_mode(_pry_, content)
+ _pry_.print = proc {}
+ _pry_.exception_handler = proc do |o, e, _p_|
+ _p_.run_command "cat --ex"
+ o.puts "...exception encountered, going interactive!"
+ interactive_mode(_pry_)
+ end
+
+ content.lines.each do |line|
+ break unless _pry_.eval line, :generated => true
+ end
+
+ unless _pry_.eval_string.empty?
+ _pry_.output.puts "#{_pry_.eval_string}...exception encountered, going interactive!"
+ interactive_mode(_pry_)
+ end
+ end
+
+ # Define a few extra commands useful for flipping back & forth
+ # between interactive/non-interactive modes
+ def define_additional_commands
+ s = self
+
+ Pry::Commands.command "make-interactive", "Make the session interactive" do
+ s.interactive_mode(_pry_)
+ end
+
+ Pry::Commands.command "load-file", "Load another file through the repl" do |file_name|
+ s.non_interactive_mode(_pry_, File.read(File.expand_path(file_name)))
+ end
+ end
+
+ # Actually load the file through the REPL by setting file content
+ # as the REPL input stream.
+ def load
+ non_interactive_mode(Pry.new, @content)
+ end
+ end
+end
diff --git a/.bundle/gems/pry-0.10.1/lib/pry/rubygem.rb b/.bundle/gems/pry-0.10.1/lib/pry/rubygem.rb
new file mode 100644
index 0000000..36f788d
--- /dev/null
+++ b/.bundle/gems/pry-0.10.1/lib/pry/rubygem.rb
@@ -0,0 +1,82 @@
+require 'rubygems'
+
+class Pry
+ module Rubygem
+
+ class << self
+ def installed?(name)
+ if Gem::Specification.respond_to?(:find_all_by_name)
+ Gem::Specification.find_all_by_name(name).any?
+ else
+ Gem.source_index.find_name(name).first
+ end
+ end
+
+ # Get the gem spec object for the given gem name.
+ #
+ # @param [String] name
+ # @return [Gem::Specification]
+ def spec(name)
+ specs = if Gem::Specification.respond_to?(:each)
+ Gem::Specification.find_all_by_name(name)
+ else
+ Gem.source_index.find_name(name)
+ end
+
+ first_spec = specs.sort_by{ |spec| Gem::Version.new(spec.version) }.last
+
+ first_spec or raise CommandError, "Gem `#{name}` not found"
+ end
+
+ # List gems matching a pattern.
+ #
+ # @param [Regexp] pattern
+ # @return [Array]
+ def list(pattern = /.*/)
+ if Gem::Specification.respond_to?(:each)
+ Gem::Specification.select{|spec| spec.name =~ pattern }
+ else
+ Gem.source_index.gems.values.select{|spec| spec.name =~ pattern }
+ end
+ end
+
+ # Completion function for gem-cd and gem-open.
+ #
+ # @param [String] so_far what the user's typed so far
+ # @return [Array] completions
+ def complete(so_far)
+ if so_far =~ / ([^ ]*)\z/
+ self.list(%r{\A#{$2}}).map(&:name)
+ else
+ self.list.map(&:name)
+ end
+ end
+
+ # Installs a gem with all its dependencies.
+ #
+ # @param [String] name
+ # @return [void]
+ def install(name)
+ gemrc_opts = Gem.configuration['gem'].split(' ')
+ destination = if gemrc_opts.include?('--user-install')
+ Gem.user_dir
+ elsif File.writable?(Gem.dir)
+ Gem.dir
+ else
+ Gem.user_dir
+ end
+ installer = Gem::DependencyInstaller.new(:install_dir => destination)
+ installer.install(name)
+ rescue Errno::EACCES
+ raise CommandError,
+ "Insufficient permissions to install #{ Pry::Helpers::Text.green(name) }."
+ rescue Gem::GemNotFoundException
+ raise CommandError,
+ "Gem #{ Pry::Helpers::Text.green(name) } not found. Aborting installation."
+ else
+ Gem.refresh
+ end
+ end
+
+ end
+end
diff --git a/.bundle/gems/pry-0.10.1/lib/pry/terminal.rb b/.bundle/gems/pry-0.10.1/lib/pry/terminal.rb
new file mode 100644
index 0000000..d04f7bd
--- /dev/null
+++ b/.bundle/gems/pry-0.10.1/lib/pry/terminal.rb
@@ -0,0 +1,79 @@
+class Pry::Terminal
+ class << self
+ # Return a pair of [rows, columns] which gives the size of the window.
+ #
+ # If the window size cannot be determined, return nil.
+ def screen_size
+ rows, cols = actual_screen_size
+ if rows.to_i != 0 && cols.to_i != 0
+ [rows.to_i, cols.to_i]
+ else
+ nil
+ end
+ end
+
+ # Return a screen size or a default if that fails.
+ def size! default = [27, 80]
+ screen_size || default
+ end
+
+ # Return a screen width or the default if that fails.
+ def width!
+ size![1]
+ end
+
+ # Return a screen height or the default if that fails.
+ def height!
+ size![0]
+ end
+
+ def actual_screen_size
+ # The best way, if possible (requires non-jruby ≥1.9 or io-console gem)
+ screen_size_according_to_io_console or
+ # Fall back to the old standby, though it might be stale:
+ screen_size_according_to_env or
+ # Fall further back, though this one is also out of date without something
+ # calling Readline.set_screen_size
+ screen_size_according_to_readline or
+ # Windows users can otherwise run ansicon and get a decent answer:
+ screen_size_according_to_ansicon_env
+ end
+
+ def screen_size_according_to_io_console
+ return if Pry::Helpers::BaseHelpers.jruby?
+ require 'io/console'
+ $stdout.winsize if $stdout.tty? and $stdout.respond_to?(:winsize)
+ rescue LoadError
+ # They probably don't have the io/console stdlib or the io-console gem.
+ # We'll keep trying.
+ end
+
+ def screen_size_according_to_env
+ size = [ENV['LINES'] || ENV['ROWS'], ENV['COLUMNS']]
+ size if nonzero_column?(size)
+ end
+
+ def screen_size_according_to_readline
+ if defined?(Readline) && Readline.respond_to?(:get_screen_size)
+ size = Readline.get_screen_size
+ size if nonzero_column?(size)
+ end
+ rescue Java::JavaLang::NullPointerException
+ # This rescue won't happen on jrubies later than:
+ # https://github.com/jruby/jruby/pull/436
+ nil
+ end
+
+ def screen_size_according_to_ansicon_env
+ return unless ENV['ANSICON'] =~ /\((.*)x(.*)\)/
+ size = [$2, $1]
+ size if nonzero_column?(size)
+ end
+
+ private
+
+ def nonzero_column?(size)
+ size[1].to_i > 0
+ end
+ end
+end
diff --git a/.bundle/gems/pry-0.10.1/lib/pry/test/helper.rb b/.bundle/gems/pry-0.10.1/lib/pry/test/helper.rb
new file mode 100644
index 0000000..8ddf144
--- /dev/null
+++ b/.bundle/gems/pry-0.10.1/lib/pry/test/helper.rb
@@ -0,0 +1,170 @@
+require 'pry'
+
+# in case the tests call reset_defaults, ensure we reset them to
+# amended (test friendly) values
+class << Pry
+ alias_method :orig_reset_defaults, :reset_defaults
+ def reset_defaults
+ orig_reset_defaults
+
+ Pry.config.color = false
+ Pry.config.pager = false
+ Pry.config.should_load_rc = false
+ Pry.config.should_load_local_rc= false
+ Pry.config.should_load_plugins = false
+ Pry.config.history.should_load = false
+ Pry.config.history.should_save = false
+ Pry.config.correct_indent = false
+ Pry.config.hooks = Pry::Hooks.new
+ Pry.config.collision_warning = false
+ end
+end
+Pry.reset_defaults
+
+# A global space for storing temporary state during tests.
+
+module PryTestHelpers
+
+ module_function
+
+ # inject a variable into a binding
+ def inject_var(name, value, b)
+ Pry.current[:pry_local] = value
+ b.eval("#{name} = ::Pry.current[:pry_local]")
+ ensure
+ Pry.current[:pry_local] = nil
+ end
+
+ def constant_scope(*names)
+ names.each do |name|
+ Object.remove_const name if Object.const_defined?(name)
+ end
+
+ yield
+ ensure
+ names.each do |name|
+ Object.remove_const name if Object.const_defined?(name)
+ end
+ end
+
+ # Open a temp file and yield it to the block, closing it after
+ # @return [String] The path of the temp file
+ def temp_file(ext='.rb')
+ file = Tempfile.new(['pry', ext])
+ yield file
+ ensure
+ file.close(true) if file
+ File.unlink("#{file.path}c") if File.exists?("#{file.path}c") # rbx
+ end
+
+ def unindent(*args)
+ Pry::Helpers::CommandHelpers.unindent(*args)
+ end
+
+ def mock_command(cmd, args=[], opts={})
+ output = StringIO.new
+ pry = Pry.new(output: output)
+ ret = cmd.new(opts.merge(pry_instance: pry, :output => output)).call_safely(*args)
+ Struct.new(:output, :return).new(output.string, ret)
+ end
+
+ def mock_exception(*mock_backtrace)
+ StandardError.new.tap do |e|
+ e.define_singleton_method(:backtrace) { mock_backtrace }
+ end
+ end
+end
+
+def pry_tester(*args, &block)
+ if args.length == 0 || args[0].is_a?(Hash)
+ args.unshift(Pry.toplevel_binding)
+ end
+
+ PryTester.new(*args).tap do |t|
+ (class << t; self; end).class_eval(&block) if block
+ end
+end
+
+def pry_eval(*eval_strs)
+ if eval_strs.first.is_a? String
+ binding = Pry.toplevel_binding
+ else
+ binding = Pry.binding_for(eval_strs.shift)
+ end
+
+ pry_tester(binding).eval(*eval_strs)
+end
+
+class PryTester
+ extend Forwardable
+
+ attr_reader :pry, :out
+
+ def_delegators :@pry, :eval_string, :eval_string=
+
+ def initialize(target = TOPLEVEL_BINDING, options = {})
+ @pry = Pry.new(options.merge(:target => target))
+ @history = options[:history]
+
+ @pry.inject_sticky_locals!
+ reset_output
+ end
+
+ def eval(*strs)
+ reset_output
+ result = nil
+
+ strs.flatten.each do |str|
+ str = "#{str.strip}\n"
+ @history.push str if @history
+
+ if @pry.process_command(str)
+ result = last_command_result_or_output
+ else
+ result = @pry.evaluate_ruby(str)
+ end
+ end
+
+ result
+ end
+
+ def push(*lines)
+ Array(lines).flatten.each do |line|
+ @pry.eval(line)
+ end
+ end
+
+ def push_binding(context)
+ @pry.push_binding context
+ end
+
+ def last_output
+ @out.string if @out
+ end
+
+ def process_command(command_str)
+ @pry.process_command(command_str) or raise "Not a valid command"
+ last_command_result_or_output
+ end
+
+ def last_command_result
+ result = Pry.current[:pry_cmd_result]
+ result.retval if result
+ end
+
+ protected
+
+ def last_command_result_or_output
+ result = last_command_result
+ if result != Pry::Command::VOID_VALUE
+ result
+ else
+ last_output
+ end
+ end
+
+ def reset_output
+ @out = StringIO.new
+ @pry.output = @out
+ end
+end
diff --git a/.bundle/gems/pry-0.10.1/lib/pry/version.rb b/.bundle/gems/pry-0.10.1/lib/pry/version.rb
new file mode 100644
index 0000000..547171e
--- /dev/null
+++ b/.bundle/gems/pry-0.10.1/lib/pry/version.rb
@@ -0,0 +1,3 @@
+class Pry
+ VERSION = "0.10.1"
+end
diff --git a/.bundle/gems/pry-0.10.1/lib/pry/wrapped_module.rb b/.bundle/gems/pry-0.10.1/lib/pry/wrapped_module.rb
new file mode 100644
index 0000000..bfa5793
--- /dev/null
+++ b/.bundle/gems/pry-0.10.1/lib/pry/wrapped_module.rb
@@ -0,0 +1,377 @@
+require 'pry/module_candidate'
+
+class Pry
+ class << self
+ # If the given object is a `Pry::WrappedModule`, return it unaltered. If it's
+ # anything else, return it wrapped in a `Pry::WrappedModule` instance.
+ def WrappedModule(obj)
+ if obj.is_a? Pry::WrappedModule
+ obj
+ else
+ Pry::WrappedModule.new(obj)
+ end
+ end
+ end
+
+ class WrappedModule
+ include Helpers::BaseHelpers
+ include CodeObject::Helpers
+
+ attr_reader :wrapped
+
+ # Convert a string to a module.
+ #
+ # @param [String] mod_name
+ # @param [Binding] target The binding where the lookup takes place.
+ # @return [Module, nil] The module or `nil` (if conversion failed).
+ # @example
+ # Pry::WrappedModule.from_str("Pry::Code")
+ def self.from_str(mod_name, target=TOPLEVEL_BINDING)
+ if safe_to_evaluate?(mod_name, target)
+ Pry::WrappedModule.new(target.eval(mod_name))
+ else
+ nil
+ end
+ rescue RescuableException
+ nil
+ end
+
+ class << self
+ private
+
+ # We use this method to decide whether code is safe to eval. Method's are
+ # generally not, but everything else is.
+ # TODO: is just checking != "method" enough??
+ # TODO: see duplication of this method in Pry::CodeObject
+ # @param [String] str The string to lookup.
+ # @param [Binding] target Where the lookup takes place.
+ # @return [Boolean]
+ def safe_to_evaluate?(str, target)
+ return true if str.strip == "self"
+ kind = target.eval("defined?(#{str})")
+ kind =~ /variable|constant/
+ end
+ end
+
+ # @raise [ArgumentError] if the argument is not a `Module`
+ # @param [Module] mod
+ def initialize(mod)
+ raise ArgumentError, "Tried to initialize a WrappedModule with a non-module #{mod.inspect}" unless ::Module === mod
+ @wrapped = mod
+ @memoized_candidates = []
+ @host_file_lines = nil
+ @source = nil
+ @source_location = nil
+ @doc = nil
+ end
+
+ # Returns an array of the names of the constants accessible in the wrapped
+ # module. This avoids the problem of accidentally calling the singleton
+ # method `Module.constants`.
+ # @param [Boolean] inherit Include the names of constants from included
+ # modules?
+ def constants(inherit = true)
+ Module.instance_method(:constants).bind(@wrapped).call(inherit)
+ end
+
+ # The prefix that would appear before methods defined on this class.
+ #
+ # i.e. the "String." or "String#" in String.new and String#initialize.
+ #
+ # @return String
+ def method_prefix
+ if singleton_class?
+ if Module === singleton_instance
+ "#{WrappedModule.new(singleton_instance).nonblank_name}."
+ else
+ "self."
+ end
+ else
+ "#{nonblank_name}#"
+ end
+ end
+
+ # The name of the Module if it has one, otherwise #.
+ #
+ # @return [String]
+ def nonblank_name
+ if name.to_s == ""
+ wrapped.inspect
+ else
+ name
+ end
+ end
+
+ # Is this a singleton class?
+ # @return [Boolean]
+ def singleton_class?
+ if Pry::Method.safe_send(wrapped, :respond_to?, :singleton_class?)
+ Pry::Method.safe_send(wrapped, :singleton_class?)
+ elsif defined?(Rubinius)
+ # https://github.com/rubinius/rubinius/commit/2e71722dba53d1a92c54d5e3968d64d1042486fe singleton_class? added 30 Jul 2014
+ # https://github.com/rubinius/rubinius/commit/4310f6b2ef3c8fc88135affe697db4e29e4621c4 has been around since 2011
+ !!Rubinius::Type.singleton_class_object(wrapped)
+ else
+ wrapped != Pry::Method.safe_send(wrapped, :ancestors).first
+ end
+ end
+
+ # Is this strictly a module? (does not match classes)
+ # @return [Boolean]
+ def module?
+ wrapped.instance_of?(Module)
+ end
+
+ # Is this strictly a class?
+ # @return [Boolean]
+ def class?
+ wrapped.instance_of?(Class)
+ end
+
+ # Get the instance associated with this singleton class.
+ #
+ # @raise ArgumentError: tried to get instance of non singleton class
+ #
+ # @return [Object]
+ def singleton_instance
+ raise ArgumentError, "tried to get instance of non singleton class" unless singleton_class?
+
+ if Helpers::BaseHelpers.jruby?
+ wrapped.to_java.attached
+ else
+ @singleton_instance ||= ObjectSpace.each_object(wrapped).detect{ |x| (class << x; self; end) == wrapped }
+ end
+ end
+
+ # Forward method invocations to the wrapped module
+ def method_missing(method_name, *args, &block)
+ wrapped.send(method_name, *args, &block)
+ end
+
+ def respond_to?(method_name)
+ super || wrapped.respond_to?(method_name)
+ end
+
+ # Retrieve the source location of a module. Return value is in same
+ # format as Method#source_location. If the source location
+ # cannot be found this method returns `nil`.
+ #
+ # @param [Module] mod The module (or class).
+ # @return [Array, nil] The source location of the
+ # module (or class), or `nil` if no source location found.
+ def source_location
+ @source_location ||= primary_candidate.source_location
+ rescue Pry::RescuableException
+ nil
+ end
+
+ # @return [String, nil] The associated file for the module (i.e
+ # the primary candidate: highest ranked monkeypatch).
+ def file
+ Array(source_location).first
+ end
+ alias_method :source_file, :file
+
+ # @return [Fixnum, nil] The associated line for the module (i.e
+ # the primary candidate: highest ranked monkeypatch).
+ def line
+ Array(source_location).last
+ end
+ alias_method :source_line, :line
+
+ # Returns documentation for the module.
+ # This documentation is for the primary candidate, if
+ # you would like documentation for other candidates use
+ # `WrappedModule#candidate` to select the candidate you're
+ # interested in.
+ # @raise [Pry::CommandError] If documentation cannot be found.
+ # @return [String] The documentation for the module.
+ def doc
+ @doc ||= primary_candidate.doc
+ end
+
+ # Returns the source for the module.
+ # This source is for the primary candidate, if
+ # you would like source for other candidates use
+ # `WrappedModule#candidate` to select the candidate you're
+ # interested in.
+ # @raise [Pry::CommandError] If source cannot be found.
+ # @return [String] The source for the module.
+ def source
+ @source ||= primary_candidate.source
+ end
+
+ # @return [String] Return the associated file for the
+ # module from YARD, if one exists.
+ def yard_file
+ YARD::Registry.at(name).file if yard_docs?
+ end
+
+ # @return [Fixnum] Return the associated line for the
+ # module from YARD, if one exists.
+ def yard_line
+ YARD::Registry.at(name).line if yard_docs?
+ end
+
+ # @return [String] Return the YARD docs for this module.
+ def yard_doc
+ YARD::Registry.at(name).docstring.to_s if yard_docs?
+ end
+
+ # Return a candidate for this module of specified rank. A `rank`
+ # of 0 is equivalent to the 'primary candidate', which is the
+ # module definition with the highest number of methods. A `rank`
+ # of 1 is the module definition with the second highest number of
+ # methods, and so on. Module candidates are necessary as modules
+ # can be reopened multiple times and in multiple places in Ruby,
+ # the candidate API gives you access to the module definition
+ # representing each of those reopenings.
+ # @raise [Pry::CommandError] If the `rank` is out of range. That
+ # is greater than `number_of_candidates - 1`.
+ # @param [Fixnum] rank
+ # @return [Pry::WrappedModule::Candidate]
+ def candidate(rank)
+ @memoized_candidates[rank] ||= Candidate.new(self, rank)
+ end
+
+ # @return [Fixnum] The number of candidate definitions for the
+ # current module.
+ def number_of_candidates
+ method_candidates.count
+ end
+
+ # @note On JRuby 1.9 and higher, in certain conditions, this method chucks
+ # away its ability to be quick (when there are lots of monkey patches,
+ # like in Rails). However, it should be efficient enough on other rubies.
+ # @see https://github.com/jruby/jruby/issues/525
+ # @return [Enumerator, Array] on JRuby 1.9 and higher returns Array, on
+ # other rubies returns Enumerator
+ def candidates
+ enum = Enumerator.new do |y|
+ (0...number_of_candidates).each do |num|
+ y.yield candidate(num)
+ end
+ end
+ Pry::Helpers::BaseHelpers.jruby_19? ? enum.to_a : enum
+ end
+
+ # @return [Boolean] Whether YARD docs are available for this module.
+ def yard_docs?
+ !!(defined?(YARD) && YARD::Registry.at(name))
+ end
+
+ # @param [Fixnum] times How far to travel up the ancestor chain.
+ # @return [Pry::WrappedModule, nil] The wrapped module that is the
+ # superclass.
+ # When `self` is a `Module` then return the
+ # nth ancestor, otherwise (in the case of classes) return the
+ # nth ancestor that is a class.
+ def super(times=1)
+ return self if times.zero?
+
+ if wrapped.is_a?(Class)
+ sup = ancestors.select { |v| v.is_a?(Class) }[times]
+ else
+ sup = ancestors[times]
+ end
+
+ Pry::WrappedModule(sup) if sup
+ end
+
+ private
+
+ # @return [Pry::WrappedModule::Candidate] The candidate with the
+ # highest rank, that is the 'monkey patch' of this module with the
+ # highest number of methods, which contains a source code line that
+ # defines the module. It is considered the 'canonical' definition
+ # for the module. In the absense of a suitable candidate, the
+ # candidate of rank 0 will be returned, or a CommandError raised if
+ # there are no candidates at all.
+ def primary_candidate
+ @primary_candidate ||= candidates.find { |c| c.file } ||
+ # This will raise an exception if there is no candidate at all.
+ candidate(0)
+ end
+
+ # @return [Array>] The array of `Pry::Method` objects,
+ # there are two associated with each candidate. The first is the 'base
+ # method' for a candidate and it serves as the start point for
+ # the search in uncovering the module definition. The second is
+ # the last method defined for that candidate and it is used to
+ # speed up source code extraction.
+ def method_candidates
+ @method_candidates ||= all_source_locations_by_popularity.map do |group|
+ methods_sorted_by_source_line = group.last.sort_by(&:source_line)
+ [methods_sorted_by_source_line.first, methods_sorted_by_source_line.last]
+ end
+ end
+
+ # A helper method.
+ def all_source_locations_by_popularity
+ return @all_source_locations_by_popularity if @all_source_locations_by_popularity
+
+ ims = all_relevant_methods_for(wrapped)
+ @all_source_locations_by_popularity = ims.group_by { |v| Array(v.source_location).first }.
+ sort_by do |path, methods|
+ expanded = File.expand_path(path)
+ load_order = $LOADED_FEATURES.index{ |file| expanded.end_with?(file) }
+
+ [-methods.size, load_order || (1.0 / 0.0)]
+ end
+ end
+
+ # We only want methods that have a non-nil `source_location`. We also
+ # skip some spooky internal methods.
+ # (i.e we skip `__class_init__` because it's an odd rbx specific thing that causes tests to fail.)
+ # @return [Array]
+ def all_relevant_methods_for(mod)
+ methods = all_methods_for(mod).select(&:source_location).
+ reject{ |x| x.name == '__class_init__' || method_defined_by_forwardable_module?(x) }
+
+ return methods unless methods.empty?
+
+ safe_send(mod, :constants).map do |const_name|
+ if const = nested_module?(mod, const_name)
+ all_relevant_methods_for(const)
+ else
+ []
+ end
+ end.flatten
+ end
+
+ # Return all methods (instance methods and class methods) for a
+ # given module.
+ # @return [Array]
+ def all_methods_for(mod)
+ Pry::Method.all_from_obj(mod, false) + Pry::Method.all_from_class(mod, false)
+ end
+
+ def nested_module?(parent, name)
+ return if safe_send(parent, :autoload?, name)
+ child = safe_send(parent, :const_get, name)
+ return unless Module === child
+ return unless safe_send(child, :name) == "#{safe_send(parent, :name)}::#{name}"
+ child
+ end
+
+ # Detect methods that are defined with `def_delegator` from the Forwardable
+ # module. We want to reject these methods as they screw up module
+ # extraction since the `source_location` for such methods points at forwardable.rb
+ # TODO: make this more robust as valid user-defined files called
+ # forwardable.rb are also skipped.
+ def method_defined_by_forwardable_module?(method)
+ method.source_location.first =~ /forwardable\.rb/
+ end
+
+ # memoized lines for file
+ def lines_for_file(file)
+ @lines_for_file ||= {}
+
+ if file == Pry.eval_path
+ @lines_for_file[file] ||= Pry.line_buffer.drop(1)
+ else
+ @lines_for_file[file] ||= File.readlines(file)
+ end
+ end
+ end
+end
diff --git a/.bundle/gems/rspec-3.3.0/License.txt b/.bundle/gems/rspec-3.3.0/License.txt
new file mode 100644
index 0000000..02bc06c
--- /dev/null
+++ b/.bundle/gems/rspec-3.3.0/License.txt
@@ -0,0 +1,24 @@
+(The MIT License)
+
+Copyright (c) 2009 Chad Humphries, David Chelimsky
+Copyright (c) 2006 David Chelimsky, The RSpec Development Team
+Copyright (c) 2005 Steven Baker
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/.bundle/gems/rspec-3.3.0/README.md b/.bundle/gems/rspec-3.3.0/README.md
new file mode 100644
index 0000000..a425898
--- /dev/null
+++ b/.bundle/gems/rspec-3.3.0/README.md
@@ -0,0 +1,34 @@
+# RSpec
+
+Behaviour Driven Development for Ruby
+
+# Description
+
+rspec is a meta-gem, which depends on the [rspec-core](https://github.com/rspec/rspec-core), [rspec-expectations](https://github.com/rspec/rspec-expectations)
+and [rspec-mocks](https://github.com/rspec/rspec-mocks) gems. Each of these can be installed separately and loaded in
+isolation using `require`. Among other benefits, this allows you to use
+rspec-expectations, for example, in Test::Unit::TestCase if you happen to
+prefer that style.
+
+Conversely, if you like RSpec's approach to declaring example groups and
+examples (`describe` and `it`) but prefer Test::Unit assertions and mocha, rr
+or flexmock for mocking, you'll be able to do that without having to install or load the
+components of RSpec that you're not using.
+
+## Documentation
+
+See http://rspec.info/documentation/ for links to documentation for all gems.
+
+## Install
+
+ gem install rspec
+
+## Contribute
+
+* [http://github.com/rspec/rspec-dev](http://github.com/rspec/rspec-dev)
+
+## Also see
+
+*
+*
+*
diff --git a/.bundle/gems/rspec-3.3.0/lib/rspec.rb b/.bundle/gems/rspec-3.3.0/lib/rspec.rb
new file mode 100644
index 0000000..36149e0
--- /dev/null
+++ b/.bundle/gems/rspec-3.3.0/lib/rspec.rb
@@ -0,0 +1,3 @@
+require 'rspec/core'
+require 'rspec/version'
+
diff --git a/.bundle/gems/rspec-3.3.0/lib/rspec/version.rb b/.bundle/gems/rspec-3.3.0/lib/rspec/version.rb
new file mode 100644
index 0000000..1114390
--- /dev/null
+++ b/.bundle/gems/rspec-3.3.0/lib/rspec/version.rb
@@ -0,0 +1,5 @@
+module RSpec # :nodoc:
+ module Version # :nodoc:
+ STRING = '3.3.0'
+ end
+end
diff --git a/.bundle/gems/rspec-core-3.3.2/.document b/.bundle/gems/rspec-core-3.3.2/.document
new file mode 100644
index 0000000..050e204
--- /dev/null
+++ b/.bundle/gems/rspec-core-3.3.2/.document
@@ -0,0 +1,5 @@
+lib/**/*.rb
+-
+README.md
+License.txt
+Changelog.md
diff --git a/.bundle/gems/rspec-core-3.3.2/.yardopts b/.bundle/gems/rspec-core-3.3.2/.yardopts
new file mode 100644
index 0000000..0ab6943
--- /dev/null
+++ b/.bundle/gems/rspec-core-3.3.2/.yardopts
@@ -0,0 +1,8 @@
+--exclude features
+--no-private
+--markup markdown
+--default-return void
+-
+Filtering.md
+Changelog.md
+License.txt
diff --git a/.bundle/gems/rspec-core-3.3.2/Changelog.md b/.bundle/gems/rspec-core-3.3.2/Changelog.md
new file mode 100644
index 0000000..44e4e2a
--- /dev/null
+++ b/.bundle/gems/rspec-core-3.3.2/Changelog.md
@@ -0,0 +1,1856 @@
+### 3.3.2 / 2015-07-15
+[Full Changelog](http://github.com/rspec/rspec-core/compare/v3.3.1...v3.3.2)
+
+Bug Fixes:
+
+* Fix formatters to handle exceptions for which `backtrace` returns `nil`.
+ (Myron Marston, #2023)
+* Fix duplicate formatter detection so that it allows subclasses of formatters
+ to be added. (Sebastián Tello, #2019)
+
+### 3.3.1 / 2015-06-18
+[Full Changelog](http://github.com/rspec/rspec-core/compare/v3.3.0...v3.3.1)
+
+Bug Fixes:
+
+* Correctly run `before(:suite)` (and friends) in the context of an example
+ group instance, thus making the expected RSpec environment available.
+ (Jon Rowe, #1986)
+
+### 3.3.0 / 2015-06-12
+[Full Changelog](http://github.com/rspec/rspec-core/compare/v3.2.3...v3.3.0)
+
+Enhancements:
+
+* Expose the reporter used to run examples via `RSpec::Core::Example#reporter`.
+ (Jon Rowe, #1866)
+* Make `RSpec::Core::Reporter#message` a public supported API. (Jon Rowe, #1866)
+* Allow custom formatter events to be published via
+ `RSpec::Core::Reporter#publish(event_name, hash_of_attributes)`. (Jon Rowe, #1869)
+* Remove dependency on the standard library `Set` and replace with `RSpec::Core::Set`.
+ (Jon Rowe, #1870)
+* Assign a unique id to each example and group so that they can be
+ uniquely identified, even for shared examples (and similar situations)
+ where the location isn't unique. (Myron Marston, #1884)
+* Use the example id in the rerun command printed for failed examples
+ when the location is not unique. (Myron Marston, #1884)
+* Add `config.example_status_persistence_file_path` option, which is
+ used to persist the last run status of each example. (Myron Marston, #1888)
+* Add `:last_run_status` metadata to each example, which indicates what
+ happened the last time an example ran. (Myron Marston, #1888)
+* Add `--only-failures` CLI option which filters to only the examples
+ that failed the last time they ran. (Myron Marston, #1888)
+* Add `--next-failure` CLI option which allows you to repeatedly focus
+ on just one of the currently failing examples, then move on to the
+ next failure, etc. (Myron Marston, #1888)
+* Make `--order random` ordering stable, so that when you rerun a
+ subset with a given seed, the examples will be order consistently
+ relative to each other. (Myron Marston, #1908)
+* Set example group constant earlier so errors when evaluating the context
+ include the example group name (Myron Marson, #1911)
+* Make `let` and `subject` threadsafe. (Josh Cheek, #1858)
+* Add version information into the JSON formatter. (Mark Swinson, #1883)
+* Add `--bisect` CLI option, which will repeatedly run your suite in
+ order to isolate the failures to the smallest reproducible case.
+ (Myron Marston, #1917)
+* For `config.include`, `config.extend` and `config.prepend`, apply the
+ module to previously defined matching example groups. (Eugene Kenny, #1935)
+* When invalid options are parsed, notify users where they came from
+ (e.g. `.rspec` or `~/.rspec` or `ENV['SPEC_OPTS']`) so they can
+ easily find the source of the problem. (Myron Marston, #1940)
+* Add pending message contents to the json formatter output. (Jon Rowe, #1949)
+* Add shared group backtrace to the output displayed by the built-in
+ formatters for pending examples that have been fixed. (Myron Marston, #1946)
+* Add support for `:aggregate_failures` metadata. Tag an example or
+ group with this metadata and it'll use rspec-expectations'
+ `aggregate_failures` feature to allow multiple failures in an example
+ and list them all, rather than aborting on the first failure. (Myron
+ Marston, #1946)
+* When no formatter implements #message add a fallback to prevent those
+ messages being lost. (Jon Rowe, #1980)
+* Profiling examples now takes into account time spent in `before(:context)`
+ hooks. (Denis Laliberté, Jon Rowe, #1971)
+* Improve failure output when an example has multiple exceptions, such
+ as one from an `it` block and one from an `after` block. (Myron Marston, #1985)
+
+Bug Fixes:
+
+* Handle invalid UTF-8 strings within exception methods. (Benjamin Fleischer, #1760)
+* Fix Rake Task quoting of file names with quotes to work properly on
+ Windows. (Myron Marston, #1887)
+* Fix `RSpec::Core::RakeTask#failure_message` so that it gets printed
+ when the task failed. (Myron Marston, #1905)
+* Make `let` work properly when defined in a shared context that is applied
+ to an individual example via metadata. (Myron Marston, #1912)
+* Ensure `rspec/autorun` respects configuration defaults. (Jon Rowe, #1933)
+* Prevent modules overriding example group defined methods when included,
+ prepended or extended by config defined after an example group. (Eugene Kenny, #1935)
+* Fix regression which caused shared examples to be mistakenly run when specs
+ where filtered to a particular location. (Ben Axnick, #1963)
+* Fix time formatting logic so that it displays 70 seconds as "1 minute,
+ 10 seconds" rather than "1 minute, 1 second". (Paul Brennan, #1984)
+* Fix regression where the formatter loader would allow duplicate formatters.
+ (Jon Rowe, #1990)
+
+### 3.2.3 / 2015-04-06
+[Full Changelog](http://github.com/rspec/rspec-core/compare/v3.2.2...v3.2.3)
+
+Bug Fixes:
+
+* Fix how the DSL methods are defined so that RSpec is compatible with
+ gems that define methods of the same name on `Kernel` (such as
+ the `its-it` gem). (Alex Kwiatkowski, Ryan Ong, #1907)
+* Fix `before(:context) { skip }` so that it does not wrongly cause the
+ spec suite to exit with a non-zero status when no examples failed.
+ (Myron Marston, #1926)
+
+### 3.2.2 / 2015-03-11
+[Full Changelog](http://github.com/rspec/rspec-core/compare/v3.2.1...v3.2.2)
+
+Bug Fixes:
+
+* Fix regression in 3.2.0 that allowed tag-filtered examples to
+ run even if there was a location filter applied to the spec
+ file that was intended to limit the file to other examples.
+ (#1894, Myron Marston)
+
+### 3.2.1 / 2015-02-23
+[Full Changelog](http://github.com/rspec/rspec-core/compare/v3.2.0...v3.2.1)
+
+Bug Fixes:
+
+* Notify start-of-run seed _before_ `start` notification rather than
+ _after_ so that formatters like Fuubar work properly. (Samuel Esposito, #1882)
+
+### 3.2.0 / 2015-02-03
+[Full Changelog](http://github.com/rspec/rspec-core/compare/v3.1.7...v3.2.0)
+
+Enhancements:
+
+* Improve the `inspect` output of example groups. (Mike Dalton, #1687)
+* When rake task fails, only output the command if `verbose` flag is
+ set. (Ben Snape, #1704)
+* Add `RSpec.clear_examples` as a clear way to reset examples in between
+ spec runs, whilst retaining user configuration. (Alexey Fedorov, #1706)
+* Reduce string allocations when defining and running examples by 70%
+ and 50% respectively. (Myron Marston, #1738)
+* Removed dependency on pathname from stdlib. (Sam Phippen, #1703)
+* Improve the message presented when a user hits Ctrl-C.
+ (Alex Chaffee #1717, #1742)
+* Improve shared example group inclusion backtrace displayed
+ in failed example output so that it works for all methods
+ of including shared example groups and shows all inclusion
+ locations. (Myron Marston, #1763)
+* Issue seed notification at start (as well as the end) of the reporter
+ run. (Arlandis Word, #1761)
+* Improve the documentation of around hooks. (Jim Kingdon, #1772)
+* Support prepending of modules into example groups from config and allow
+ filtering based on metadata. (Arlandis Word, #1806)
+* Emit warnings when `:suite` hooks are registered on an example group
+ (where it has always been ignored) or are registered with metadata
+ (which has always been ignored). (Myron Marston, #1805)
+* Provide a friendly error message when users call RSpec example group
+ APIs (e.g. `context`, `describe`, `it`, `let`, `before`, etc) from
+ within an example where those APIs are unavailable. (Myron Marston, #1819)
+* Provide a friendly error message when users call RSpec example
+ APIs (e.g. `expect`, `double`, `stub_const`, etc) from
+ within an example group where those APIs are unavailable.
+ (Myron Marston, #1819)
+* Add new `RSpec::Core::Sandbox.sandboxed { }` API that facilitates
+ testing RSpec with RSpec, allowing you to define example groups
+ and example from within an example without affecting the global
+ `RSpec.world` state. (Tyler Ball, 1808)
+* Apply line-number filters only to the files they are scoped to,
+ allowing you to mix filtered and unfiltered files. (Myron Marston, #1839)
+* When dumping pending examples, include the failure details so that you
+ don't have to un-pend the example to see it. (Myron Marston, #1844)
+* Make `-I` option support multiple values when separated by
+ `File::PATH_SEPARATOR`, such as `rspec -I foo:bar`. This matches
+ the behavior of Ruby's `-I` option. (Fumiaki Matsushima, #1855).
+* Treat each example as having a singleton example group for the
+ purposes of applying metadata-based features that normally apply
+ to example groups to individually tagged examples. For example,
+ `RSpec.shared_context "Uses redis", :uses_redis` will now apply
+ to individual examples tagged with `:uses_redis`, as will
+ `config.include RedisHelpers, :uses_redis`, and
+ `config.before(:context, :uses_redis) { }`, etc. (Myron Marston, #1749)
+
+Bug Fixes:
+
+* When assigning generated example descriptions, surface errors
+ raised by `matcher.description` in the example description.
+ (Myron Marston, #1771)
+* Don't consider expectations from `after` hooks when generating
+ example descriptions. (Myron Marston, #1771)
+* Don't apply metadata-filtered config hooks to examples in groups
+ with matching metadata when those examples override the parent
+ metadata value to not match. (Myron Marston, #1796)
+* Fix `config.expect_with :minitest` so that `skip` uses RSpec's
+ implementation rather than Minitest's. (Jonathan Rochkind, #1822)
+* Fix `NameError` caused when duplicate example group aliases are defined and
+ the DSL is not globally exposed. (Aaron Kromer, #1825)
+* When a shared example defined in an external file fails, use the host
+ example group (from a loaded spec file) for the re-run command to
+ ensure the command will actually work. (Myron Marston, #1835)
+* Fix location filtering to work properly for examples defined in
+ a nested example group within a shared example group defined in
+ an external file. (Bradley Schaefer, Xavier Shay, Myron Marston, #1837)
+* When a pending example fails (as expected) due to a mock expectation,
+ set `RSpec::Core::Example::ExecutionResult#pending_exception` --
+ previously it was not being set but should have been. (Myron Marston, #1844)
+* Fix rake task to work when `rspec-core` is installed in a directory
+ containing a space. (Guido Günther, #1845)
+* Fix regression in 3.1 that caused `describe Regexp` to raise errors.
+ (Durran Jordan, #1853)
+* Fix regression in 3.x that caused the profile information to be printed
+ after the summary. (Max Lincoln, #1857)
+* Apply `--seed` before loading `--require` files so that required files
+ can access the provided seed. (Myron Marston, #1745)
+* Handle `RSpec::Core::Formatters::DeprecationFormatter::FileStream` being
+ reopened with an IO stream, which sometimes happens with spring.
+ (Kevin Mook, #1757)
+
+### 3.1.7 / 2014-10-11
+[Full Changelog](http://github.com/rspec/rspec-core/compare/v3.1.6...v3.1.7)
+
+Bug Fixes:
+
+* Fix `Metadata.relative_path` so that for a current directory of
+ `/foo/bar`, `/foo/bar_1` is not wrongly converted to `._1`.
+ (Akos Vandra, #1730)
+* Prevent constant lookup mistakenly finding `RSpec::ExampleGroups` generated
+ constants on 1.9.2 by appending a trailing `_` to the generated names.
+ (Jon Rowe, #1737)
+* Fix bug in `:pending` metadata. If it got set in any way besides passing
+ it as part of the metadata literal passed to `it` (such as by using
+ `define_derived_metadata`), it did not have the desired effect,
+ instead marking the example as `:passed`. (Myron Marston, #1739)
+
+### 3.1.6 / 2014-10-08
+[Full Changelog](http://github.com/rspec/rspec-core/compare/v3.1.5...v3.1.6)
+
+Bug Fixes:
+
+* Fix regression in rake task pattern handling, that prevented patterns
+ that were relative from the current directory rather than from `spec`
+ from working properly. (Myron Marston, #1734)
+* Prevent rake task from generating duplicate load path entries.
+ (Myron Marston, #1735)
+
+### 3.1.5 / 2014-09-29
+[Full Changelog](http://github.com/rspec/rspec-core/compare/v3.1.4...v3.1.5)
+
+Bug Fixes:
+
+* Fix issue with the rake task incorrectly escaping strings on Windows.
+ (Jon Rowe #1718)
+* Support absolute path patterns. While this wasn't officially supported
+ previously, setting `rake_task.pattern` to an absolute path pattern in
+ RSpec 3.0 and before worked since it delegated to `FileList` internally
+ (but now just forwards the pattern on to the `rspec` command).
+ (Myron Marston, #1726)
+
+### 3.1.4 / 2014-09-18
+[Full Changelog](http://github.com/rspec/rspec-core/compare/v3.1.3...v3.1.4)
+
+Bug Fixes:
+
+* Fix implicit `subject` when using `describe false` or `describe nil`
+ so that it returns the provided primitive rather than the string
+ representation. (Myron Marston, #1710)
+* Fix backtrace filtering to allow code in subdirectories of your
+ current working directory (such as vendor/bundle/...) to be filtered
+ from backtraces. (Myron Marston, #1708)
+
+### 3.1.3 / 2014-09-15
+[Full Changelog](http://github.com/rspec/rspec-core/compare/v3.1.2...v3.1.3)
+
+Bug Fixes:
+
+* Fix yet another regression in rake task pattern handling, to allow
+ `task.pattern = FileList["..."]` to work. That was never intended
+ to be supported but accidentally worked in 3.0 and earlier.
+ (Myron Marston, #1701)
+* Fix pattern handling so that files are normalized to absolute paths
+ before subtracting the `--exclude-pattern` matched files from the
+ `--pattern` matched files so that it still works even if the patterns
+ are in slightly different forms (e.g. one starting with `./`).
+ (Christian Nelson, #1698)
+
+### 3.1.2 / 2014-09-08
+[Full Changelog](http://github.com/rspec/rspec-core/compare/v3.1.1...v3.1.2)
+
+Bug Fixes:
+
+* Fix another regression in rake task pattern handling, so that patterns
+ that start with `./` still work. (Christian Nelson, #1696)
+
+### 3.1.1 / 2014-09-05
+[Full Changelog](http://github.com/rspec/rspec-core/compare/v3.1.0...v3.1.1)
+
+Bug Fixes:
+
+* Fix a regression in rake task pattern handling, so that `rake_task.pattern = array`
+ works again. While we never intended to support array values (or even knew that worked!),
+ the implementation from 3.0 and earlier used `FileList` internally, which allows arrays.
+ The fix restores the old behavior. (Myron Marston, #1694)
+
+### 3.1.0 / 2014-09-04
+[Full Changelog](http://github.com/rspec/rspec-core/compare/v3.0.4...v3.1.0)
+
+Enhancements:
+
+* Update files generated by `rspec --init` so that warnings are enabled
+ in commented out section of `spec_helper` rather than `.rspec` so users
+ have to consciously opt-in to the setting. (Andrew Hooker, #1572)
+* Update `spec_helper` generated by `rspec --init` so that it sets the new
+ rspec-expectations `include_chain_clauses_in_custom_matcher_descriptions`
+ config option (which will be on by default in RSpec 4) and also sets the
+ rspec-mocks `verify_partial_doubles` option (which will also default
+ to on in RSpec 4). (Myron Marston, #1647)
+* Provide an `inspect` output for example procsy objects (used in around
+ hooks) that doesn't make them look like procs. (Jon Rowe, #1620)
+* Remove a few unneeded `require` statements from
+ `rspec/core/rake_task.rb`, making it even more lighterweight.
+ (Myron Marston, #1640)
+* Allow rspec-core to be used when neither rspec-mocks or
+ rspec-expectations are installed, without requiring any
+ user configuration. (Sam Phippen, Myron Marston, #1615)
+* Don't filter out gems from backtraces by default. (The RSpec
+ gems will still be filtered). User feedback has indicated
+ that including gems in default backtraces will be useful.
+ (Myron Marston, #1641)
+* Add new `config.filter_gems_from_backtrace "rack", "rake"` API
+ to easily filter the named gems from backtraces. (Myron Marston, #1682)
+* Fix default backtrace filters so that the RSpec binary is
+ excluded when installing RSpec as a bundler `:git` dependency.
+ (Myron Marston, #1648)
+* Simplify command generated by the rake task so that it no longer
+ includes unnecessary `-S`. (Myron Marston, #1559)
+* Add `--exclude-pattern` CLI option, `config.exclude_pattern =` config
+ option and `task.exclude_pattern =` rake task config option. Matching
+ files will be excluded. (John Gesimondo, Myron Marston, #1651, #1671)
+* When an around hook fails to execute the example, mark it as
+ pending (rather than passing) so the user is made aware of the
+ fact that the example did not actually run. (Myron Marston, #1660)
+* Remove dependency on `FileUtils` from the standard library so that users do
+ not get false positives where their code relies on it but they are not
+ requiring it. (Sam Phippen, #1565)
+
+Bug Fixes:
+
+* Fix rake task `t.pattern =` option so that it does not run all specs
+ when it matches no files, by passing along a `--pattern` option to
+ the `rspec` command, rather than resolving the file list and passing
+ along the files individually. (Evgeny Zislis, #1653)
+* Fix rake task default pattern so that it follows symlinks properly.
+ (Myron Marston, #1672)
+* Fix default pattern used with `rspec` command so that it follows
+ symlinks properly. (Myron Marston, #1672)
+* Change how we assign constant names to example group classes so that
+ it avoids a problem with `describe "Core"`. (Daniela Wellisz, #1679)
+* Handle rendering exceptions that have a different encoding than that
+ of their original source file. (Jon Rowe, #1681)
+* Allow access to message_lines without colour for failed examples even
+ when they're part of a shared example group. (tomykaira, #1689)
+
+### 3.0.4 / 2014-08-14
+[Full Changelog](http://github.com/rspec/rspec-core/compare/v3.0.3...v3.0.4)
+
+Bug Fixes:
+
+* Fix processing order of CLI options so that if `config.files_to_run`
+ is accessed from a file loaded by `--require`, `--pattern` is still
+ applied. (Myron Marston, #1652)
+* Fix `config.pattern=` so that it still takes affect even if
+ `config.files_to_run` has already been accessed. (Myron Marston, #1652)
+
+### 3.0.3 / 2014-07-21
+[Full Changelog](http://github.com/rspec/rspec-core/compare/v3.0.2...v3.0.3)
+
+Bug Fixes:
+
+* Properly convert both parts of a description into strings before
+ concatenation. (@nicklink483, #1636)
+* Exclude the working directory when figuring out folders to ignore.
+ (Jon Rowe, Myron Marston, #1616)
+* Allow `::RSpec::Core::Notifications::FailedExampleNotification#message_lines`
+ to be accessed without a colouriser. (@tomykaira, #1637)
+
+### 3.0.2 / 2014-06-19
+[Full Changelog](http://github.com/rspec/rspec-core/compare/v3.0.1...v3.0.2)
+
+Bug Fixes:
+
+* Fix regression in CLI option handling that prevented `--tag slow`
+ passed at the command line from overriding `--tag ~slow` in `.rspec`.
+ (Colin Jones, #1602)
+* Fix metadata `:example_group` deprecation warning so that it gets
+ issued at the call site of the configuration that specified it as
+ a filter rather than later when an example group is defined.
+ (Myron Marston, #1562)
+* Make the line that is printed when a shared example group fails indicating
+ where the concrete example group is white, separating it from the stack trace
+ that is produced for the failure. (Sam Phippen, Jon Rowe, #1606)
+
+### 3.0.1 / 2014-06-12
+[Full Changelog](http://github.com/rspec/rspec-core/compare/v3.0.0...v3.0.1)
+
+Bug Fixes:
+
+* Fix a couple ruby warnings caused by rspec-core when loaded.
+ (Prem Sichanugrist, #1584)
+* Example groups named `Config` will no longer cause a Ruby warning to be
+ issued. (Jimmy Cuadra, #1580)
+
+### 3.0.0 / 2014-06-01
+[Full Changelog](http://github.com/rspec/rspec-core/compare/v3.0.0.rc1...v3.0.0)
+
+Bug Fixes:
+
+* Fix `BaseTextFormatter` so that it does not re-close a closed output
+ stream. (Myron Marston)
+* Fix regression in metadata that caused the metadata hash of a top-level
+ example group to have a `:parent_example_group` key even though it has
+ no parent example group. (Myron Marston)
+
+Enhancements:
+
+* Alter the default `spec_helper.rb` to no longer recommend
+ `config.full_backtrace = true` see #1536 for discussion. (Jon Rowe)
+
+### 3.0.0.rc1 / 2014-05-18
+[Full Changelog](http://github.com/rspec/rspec-core/compare/v3.0.0.beta2...v3.0.0.rc1)
+
+Breaking Changes for 3.0.0:
+
+* Change `described_class` so that in a nested group like `describe
+ MyClass`, it returns `MyClass` rather than the outer group's described
+ class. (Myron Marston)
+* Refactor filter manager so that it no longer subclasses Hash and has a
+ tighter, more domain-specific interface. (Sergey Pchelincev)
+* Remove legacy colours definitions from `BaseTextFormatter`. (Jon Rowe)
+* Remove console color definitions from `BaseTextFormatter`. (Jon Rowe)
+* Restructure example group metadata so that the computed keys are
+ exposed directly off of the metadata hash rather than being on
+ a nested `:example_group` subhash. In addition, the parent example
+ group metadata is now available as `[:parent_example_group]` rather
+ than `[:example_group][:example_group]`. Deprecated access via the
+ old key structure is still provided. (Myron Marston)
+* Remove `:describes` metadata key. It duplicates `:described_class`
+ for no good reason. Deprecated access via `:describes` is still
+ provided. (Myron Marston)
+* Rename `:example_group_block` metadata key to `:block`.
+ (Myron Marston)
+* Remove deprecated `RSpec::Core::Example#options`. (Myron Marston)
+* Move `BaseTextFormatter#colorize_summary` to `SummaryNotification#colorize_with`
+ (Jon Rowe).
+* `describe some_hash` treated `some_hash` as metadata in RSpec 2.x but
+ will treat it as the described object in RSpec 3.0. Metadata must
+ always come after the description args. (Myron Marston)
+* Remove deprecated `display_name` alias of `ExampleGroup.description`.
+ (Myron Marston)
+* Remove deprecated `describes` alias of `ExampleGroup.described_class`.
+ (Myron Marston)
+* Remove deprecated `RSpec::Core::ExampleGroup.alias_it_behaves_like_to`.
+ Use `RSpec::Core::Configuration#alias_it_behaves_like_to` instead.
+ (Myron Marston)
+* Remove deprecated `RSpec::Core::ExampleGroup.alias_example_to`.
+ Use `RSpec::Core::Configuration#alias_example_to` instead.
+ (Myron Marston)
+* Removed `focused` example alias and change example/group aliases
+ `fit`, `focus`, `fcontext` and `fdescribe` to no longer include
+ `:focused => true` metadata. They only contain `:focus => true`
+ metadata now. This means that you will need to filter them with
+ `filter_run :focus`, not `filter_run :focused`. (Myron Marston)
+* Remove `--line-number` filtering. It's semantically dubious since it's
+ a global filter (potentially applied to multiple files) but there's no
+ meaningful connection between the same line number in multiple files.
+ Instead use the `rspec path/to/spec.rb:23:46` form, which is terser
+ and makes more sense as it is scoped to a file. (Myron Marston)
+* Remove `--default_path` as an alias for `--default-path`. (Jon Rowe)
+* Remove deprecated `share_examples_for`. There's still
+ `shared_examples` and `shared_examples_for`. (Myron Marston)
+* Rename `RSpec::Core::Configuration#warnings` to
+ `RSpec::Core::Configuration#warnings?` since it's a boolean flag.
+ (Myron Marston)
+* RSpec's global state is no longer reset after a spec run. This gives
+ more flexibility to alternate runners to decide when and if they
+ want the state reset. Alternate runners are now responsible for
+ calling this (or doing a similar reset) if they are going to run
+ the spec suite multiple times in the same process. (Sam Phippen)
+* Merge `RSpec::Core::CommandLine` (never formally declared public)
+ into `RSpec::Core::Runner`. (Myron Marston)
+* Remove `color_enabled` as an alias of `color`. (Jon Rowe)
+* Remove `backtrace_cleaner` as an alias of `backtrace_formatter`. (Jon Rowe)
+* Remove `filename_pattern` as an alias of `pattern`. (Jon Rowe)
+* Extract support for legacy formatters to `rspec-legacy_formatters`. (Jon Rowe)
+* `RSpec::Configuration#formatters` now returns a dup to prevent mutation. (Jon Rowe)
+* Replace `stdlib` as an available expectation framework with `test_unit` and
+ `minitest`. (Aaron Kromer)
+* Remove backtrace formatting helpers from `BaseTextFormatter`. (Jon Rowe)
+* Extract profiler support to `ProfileFormatter` and `ProfileNotification`.
+ Formatters should implement `dump_profile` if they wish to respond to `--profile`.
+ (Jon Rowe)
+* Extract remaining formatter state to reporter and notifications. Introduce
+ `ExamplesNotification` to share information about examples that was previously
+ held in `BaseFormatter`. (Jon Rowe)
+
+Enhancements:
+
+* Add `config.default_formatter` attribute, which can be used to set a
+ formatter which will only be used if no other formatter is set
+ (e.g. via `--formatter`). (Myron Marston)
+* Support legacy colour definitions in `LegacyFormatterAdaptor`. (Jon Rowe)
+* Migrate `execution_result` (exposed by metadata) from a hash to a
+ first-class object with appropriate attributes. `status` is now
+ stored and returned as a symbol rather than a string. It retains
+ deprecated hash behavior for backwards compatibility. (Myron Marston)
+* Provide console code helper for formatters. (Jon Rowe)
+* Use raw ruby hashes for the metadata hashes rather than a subclass of
+ a hash. Computed metadata entries are now computed in advance rather
+ than being done lazily on first access. (Myron Marston)
+* Add `:block` metadata entry to the example metadata, bringing
+ parity with `:block` in the example group metadata. (Myron Marston)
+* Add `fspecify` and `fexample` as aliases of `specify` and `example`
+ with `:focus => true` metadata for parity with `fit`. (Myron Marston)
+* Add legacy support for `colorize_summary`. (Jon Rowe)
+* Restructure runner so it can be more easily customized in a subclass
+ for an alternate runner. (Ben Hoskings)
+* Document `RSpec::Core::ConfigurationOptions` as an officially
+ supported public API. (Myron Marston)
+* Add `--deprecation-out` CLI option which directs deprecation warnings
+ to the named file. (Myron Marston)
+* Minitest 5 compatability for `expect_with :stdlib` (now available as
+ `expect_with :minitest`). (Xavier Shay)
+* Reporter now notifies formatters of the load time of RSpec and your
+ specs via `StartNotification` and `SummaryNotification`. (Jon Rowe)
+* Add `disable_monkey_patching!` config option that disables all monkey
+ patching from whatever pieces of RSpec you use. (Alexey Fedorov)
+* Add `Pathname` support for setting all output streams. (Aaron Kromer)
+* Add `config.define_derived_metadata`, which can be used to apply
+ additional metadata to all groups or examples that match a given
+ filter. (Myron Marston)
+* Provide formatted and colorized backtraces via `FailedExampleNotification`
+ and send `PendingExampleFixedNotifications` when the error is due to a
+ passing spec you expect to fail. (Jon Rowe)
+* Add `dump_profile` to formatter API to allow formatters to implement
+ support for `--profile`. (Jon Rowe)
+* Allow colourising text via `ConsoleCodes` with RSpec 'states'
+ (e.g. `:success`, `:failure`) rather than direct colour codes. (Jon Rowe)
+* Expose `fully_formatted` methods off the formatter notification objects
+ that make it easy for a custom formatter to produce formatted output
+ like rspec-core's. (Myron Marston)
+
+Bug Fixes:
+
+* Fix `spec_helper.rb` file generated by `rspec --init` so that the
+ recommended settings correctly use the documentation formatter
+ when running one file. (Myron Marston)
+* Fix ordering problem where descriptions were generated after
+ tearing down mocks, which resulted in unexpected exceptions.
+ (Bradley Schaefer, Aaron Kromer, Andrey Savchenko)
+* Allow a symbol to be used as an implicit subject (e.g. `describe
+ :foo`). (Myron Marston)
+* Prevent creating an isolated context (i.e. using `RSpec.describe`) when
+ already inside a context. There is no reason to do this, and it could
+ potentially cause unexpected bugs. (Xavier Shay)
+* Fix shared example group scoping so that when two shared example
+ groups share the same name at different levels of nested contexts,
+ the one in the nearest context is used. (Myron Marston)
+* Fix `--warnings` option so that it enables warnings immediately so
+ that it applies to files loaded by `--require`. (Myron Marston)
+* Issue a warning when you set `config.deprecation_stream` too late for
+ it to take effect because the reporter has already been setup. (Myron Marston)
+* Add the full `RSpec::Core::Example` interface to the argument yielded
+ to `around` hooks. (Myron Marston)
+* Line number always takes precendence when running specs with filters.
+ (Xavier Shay)
+* Ensure :if and :unless metadata filters are treated as a special case
+ and are always in-effect. (Bradley Schaefer)
+* Ensure the currently running installation of RSpec is used when
+ the rake task shells out to `rspec`, even if a newer version is also
+ installed. (Postmodern)
+* Using a legacy formatter as default no longer causes an infinite loop.
+ (Xavier Shay)
+
+### 3.0.0.beta2 / 2014-02-17
+[Full Changelog](http://github.com/rspec/rspec-core/compare/v3.0.0.beta1...v3.0.0.beta2)
+
+Breaking Changes for 3.0.0:
+
+* Make `mock_with` option more strict. Strings are no longer supported
+ (e.g. `mock_with "mocha"`) -- use a symbol instead. Also, unrecognized
+ values will now result in an error rather than falling back to the
+ null mocking adapter. If you want to use the null mocking adapter,
+ use `mock_with :nothing` (as has been documented for a long time).
+ (Myron Marston)
+* Remove support for overriding RSpec's built-in `:if` and `:unless`
+ filters. (Ashish Dixit)
+* Custom formatters are now required to call
+ `RSpec::Core::Formatters.register(formatter_class, *notifications)`
+ where `notifications` is the list of events the formatter wishes to
+ be notified about. Notifications are handled by methods matching the
+ names on formatters. This allows us to add or remove notifications
+ without breaking existing formatters. (Jon Rowe)
+* Change arguments passed to formatters. Rather than passing multiple
+ arguments (which limits are ability to add additional arguments as
+ doing so would break existing formatters), we now pass a notification
+ value object that exposes the same data via attributes. This will
+ allow us to add new bits of data to a notification event without
+ breaking existing formatters. (Jon Rowe)
+* Remove support for deprecated `:alias` option for
+ `RSpec.configuration.add_setting`. (Myron Marston)
+* Remove support for deprecated `RSpec.configuration.requires = [...]`.
+ (Myron Marston)
+* Remove support for deprecated `--formatter` CLI option. (Myron Marston)
+* Remove support for deprecated `--configure` CLI option. (Myron Marston)
+* Remove support for deprecated `RSpec::Core::RakeTask#spec_opts=`.
+ (Myron Marston)
+* An example group level `pending` block or `:pending` metadata now executes
+ the example and cause a failure if it passes, otherwise it will be pending if
+ it fails. The old "never run" behaviour is still used for `xexample`, `xit`,
+ and `xspecify`, or via a new `skip` method or `:skip` metadata option.
+ (Xavier Shay)
+* After calling `pending` inside an example, the remainder of the example will
+ now be run. If it passes a failure is raised, otherwise the example is marked
+ pending. The old "never run" behaviour is provided a by a new `skip` method.
+ (Xavier Shay)
+* Pending blocks inside an example have been removed as a feature with no
+ direct replacement. Use `skip` or `pending` without a block. (Xavier Shay)
+* Pending statement is no longer allowed in `before(:all)` hooks. Use `skip`
+ instead. (Xavier Shay)
+* Remove `show_failures_in_pending_blocks` configuration option. (Xavier Shay)
+* Remove support for specifying the documentation formatter using
+ 's', 'n', 'spec' or 'nested'. (Jon Rowe)
+
+Enhancements:
+
+* Add example run time to JSON formatter output. (Karthik Kastury)
+* Add more suggested settings to the files generated by
+ `rspec --init`. (Myron Marston)
+* Add `config.alias_example_group_to`, which can be used to define a
+ new method that defines an example group with the provided metadata.
+ (Michi Huber)
+* Add `xdescribe` and `xcontext` as shortcuts to skip an example group.
+ (Myron Marston)
+* Add `fdescribe` and `fcontext` as shortcuts to focus an example group.
+ (Myron Marston)
+* Don't autorun specs via `#at_exit` by default. `require 'rspec/autorun'`
+ is only needed when running specs via `ruby`, as it always has been.
+ Running specs via `rake` or `rspec` are both unaffected. (Ben Hoskings)
+* Add `expose_dsl_globally` config option, defaulting to true. When disabled
+ it will remove the monkey patches rspec-core adds to `main` and `Module`
+ (e.g. `describe`, `shared_examples_for`, etc). (Jon Rowe)
+* Expose RSpec DSL entry point methods (`describe`,
+ `shared_examples_for`, etc) on the `RSpec` constant. Intended for use
+ when `expose_dsl_globally` is set to `false`. (Jon Rowe)
+* For consistency, expose all example group aliases (including
+ `context`) on the `RSpec` constant. If `expose_dsl_globally` is set to
+ `true`, also expose them on `main` and `Module`. Historically, only `describe`
+ was exposed. (Jon Rowe, Michi Huber)
+* Add hook scope `:example` as an alias for `:each`, and `:context` as an alias
+ for `:all`. (John Feminella)
+
+Bug Fixes:
+
+* Fix failure (undefined method `path`) in end-of-run summary
+ when `raise_errors_for_deprecations!` is configured. (Myron Marston)
+* Issue error when attempting to use `-i` or `--I` on command line,
+ too close to `-I` to be considered short hand for `--init`. (Jon Rowe)
+* Prevent adding formatters to an output target if the same
+ formatter has already been added to that output. (Alex Peattie)
+* Allow a matcher-generated example description to be used when
+ the example is pending. (Myron Marston)
+* Ensure the configured `failure_exit_code` is used by the rake
+ task when there is a failure. (Jon Rowe)
+* Restore behaviour whereby system exclusion filters take priority over working
+ directory (was broken in beta1). (Jon Rowe)
+* Prevent RSpec mangling file names that have substrings containing `line_number`
+ or `default_path`. (Matijs van Zuijlen)
+* Fix failure line detection so that it handles relative file paths
+ (which can happen when running specs through `ruby` using `rspec/autorun`).
+ (Myron Marston, #1829)
+
+### 3.0.0.beta1 / 2013-11-07
+[Full Changelog](http://github.com/rspec/rspec-core/compare/v2.99.1...v3.0.0.beta1)
+
+Breaking Changes for 3.0.0:
+
+* Remove explicit support for 1.8.6. (Jon Rowe)
+* Remove `RSpec::Core::ExampleGroup#example` and
+ `RSpec::Core::ExampleGroup#running_example` methods. If you need
+ access to the example (e.g. to get its metadata), use a block arg
+ instead. (David Chelimsky)
+* Remove `TextMateFormatter`, it has been moved to `rspec-tmbundle`.
+ (Aaron Kromer)
+* Remove RCov integration. (Jon Rowe)
+* Remove deprecated support for RSpec 1 constructs (Myron Marston):
+ * The `Spec` and `Rspec` constants (rather than `RSpec`).
+ * `Spec::Runner.configure` rather than `RSpec.configure`.
+ * `Rake::SpecTask` rather than `RSpec::Core::RakeTask`.
+* Remove deprecated support for `share_as`. (Myron Marston)
+* Remove `--debug` option (and corresponding option on
+ `RSpec::Core::Configuration`). Instead, use `-r` to
+ load whichever debugger gem you wish to use (e.g. `ruby-debug`,
+ `debugger`, or `pry`). (Myron Marston)
+* Extract Autotest support to a seperate gem. (Jon Rowe)
+* Raise an error when a `let` or `subject` declaration is
+ accessed in a `before(:all)` or `after(:all)` hook. (Myron Marston)
+* Extract `its` support to a separate gem. (Peter Alfvin)
+* Disallow use of a shared example group from sibling contexts, making them
+ fully isolated. 2.14 and 2.99 allowed this but printed a deprecation warning.
+ (Jon Rowe)
+* Remove `RSpec::Core::Configuration#output` and
+ `RSpec::Core::Configuration#out` aliases of
+ `RSpec::Core::Configuration#output_stream`. (Myron Marston)
+* Remove legacy ordering APIs deprecated in 2.99.0.beta1. (Myron
+ Marston)
+
+Enhancements:
+
+* Replace unmaintained syntax gem with coderay gem. (Xavier Shay)
+* Times in profile output are now bold instead of `failure_color`.
+ (Matthew Boedicker)
+* Add `--no-fail-fast` command line option. (Gonzalo Rodríguez-Baltanás Díaz)
+* Runner now considers the local system ip address when running under Drb.
+ (Adrian CB)
+* JsonFormatter now includes `--profile` information. (Alex / @MasterLambaster)
+* Always treat symbols passed as metadata args as hash
+ keys with true values. RSpec 2 supported this with the
+ `treat_symbols_as_metadata_keys_with_true_values` but
+ now this behavior is always enabled. (Myron Marston)
+* Add `--dry-run` option, which prints the formatter output
+ of your suite without running any examples or hooks.
+ (Thomas Stratmann, Myron Marston)
+* Document the configuration options and default values in the `spec_helper.rb`
+ file that is generated by RSpec. (Parker Selbert)
+* Give generated example group classes a friendly name derived
+ from the docstring, rather than something like "Nested_2".
+ (Myron Marston)
+* Avoid affecting randomization of user code when shuffling
+ examples so that users can count on their own seeds
+ working. (Travis Herrick)
+* Ordering is no longer a single global property of the test suite.
+ Each group can pick an ordering using `:order` metadata. (Andy
+ Lindeman, Sam Phippen, Myron Marston)
+* Allow named custom ordering strategies to be registered, which can
+ then be used on individual example groups. (Andy Lindeman, Sam
+ Phippen, Myron Marston)
+
+Deprecations:
+
+* `treat_symbols_as_metadata_keys_with_true_values` is deprecated and no
+ longer has an affect now that the behavior it enabled is always
+ enabled. (Myron Marston)
+
+### 2.99.2 / 2014-08-19
+[Full Changelog](http://github.com/rspec/rspec-core/compare/v2.99.1...v2.99.2)
+
+Enhancements:
+
+* Improve deprecation warning for RSpec 3 change in `describe `
+ behavior. (Jon Rowe, #1667)
+
+### 2.99.1 / 2014-06-19
+[Full Changelog](http://github.com/rspec/rspec-core/compare/v2.99.0...v2.99.1)
+
+Bug Fixes:
+
+* Add missing deprecation warning for when `RSpec::Core::Runner` is used
+ multiple times in the same process. In 2.x RSpec's global state was
+ automatically cleared between runs but in 3.0 you need to call `RSpec.reset`
+ manually in these situations. (Sam Phippen, #1587)
+* Prevent deprecation being accidentally issues when doubles used with `be_`
+ matchers due to automatically generated descriptions. (Jon Rowe, #1573)
+* Load `rspec/core` when loading `rspec/core/rake_task` to ensure we can
+ issue deprecations correctly. (Jon Rowe, #1612)
+
+### 2.99.0 / 2014-06-01
+[Full Changelog](http://github.com/rspec/rspec-core/compare/v2.99.0.rc1...v2.99.0)
+
+Bug Fixes:
+
+* Fix `BaseTextFormatter` so that it does not re-close a closed output
+ stream. (Myron Marston)
+* Use `RSpec::Configuration#backtrace_exclusion_patterns` rather than the
+ deprecated `RSpec::Configuration#backtrace_clean_patterns` when mocking
+ with rr. (David Dollar)
+
+### 2.99.0.rc1 / 2014-05-18
+[Full Changelog](http://github.com/rspec/rspec-core/compare/v2.99.0.beta2...v2.99.0.rc1)
+
+Enhancements:
+
+* Add `--deprecation-out` CLI option which directs deprecation warnings
+ to the named file. (Myron Marston)
+* Backport support for `skip` in metadata to skip execution of an example.
+ (Xavier Shay, #1472)
+* Add `Pathname` support for setting all output streams. (Aaron Kromer)
+* Add `test_unit` and `minitest` expectation frameworks. (Aaron Kromer)
+
+Deprecations:
+
+* Deprecate `RSpec::Core::Pending::PendingDeclaredInExample`, use
+ `SkipDeclaredInExample` instead. (Xavier Shay)
+* Issue a deprecation when `described_class` is accessed from within
+ a nested `describe ` example group, since `described_class`
+ will return the innermost described class in RSpec 3 rather than the
+ outermost described class, as it behaved in RSpec 2. (Myron Marston)
+* Deprecate `RSpec::Core::FilterManager::DEFAULT_EXCLUSIONS`,
+ `RSpec::Core::FilterManager::STANDALONE_FILTERS` and use of
+ `#empty_without_conditional_filters?` on those filters. (Sergey Pchelincev)
+* Deprecate `RSpec::Core::Example#options` in favor of
+ `RSpec::Core::Example#metadata`. (Myron Marston)
+* Issue warning when passing a symbol or hash to `describe` or `context`
+ as the first argument. In RSpec 2.x this would be treated as metadata
+ but in RSpec 3 it'll be treated as the described object. To continue
+ having it treated as metadata, pass a description before the symbol or
+ hash. (Myron Marston)
+* Deprecate `RSpec::Core::BaseTextFormatter::VT100_COLORS` and
+ `RSpec::Core::BaseTextFormatter::VT100_COLOR_CODES` in favour
+ of `RSpec::Core::BaseTextFormatter::ConsoleCodes::VT100_CODES` and
+ `RSpec::Core::BaseTextFormatter::ConsoleCodes::VT100_CODE_VALUES`.
+ (Jon Rowe)
+* Deprecate `RSpec::Core::ExampleGroup.display_name` in favor of
+ `RSpec::Core::ExampleGroup.description`. (Myron Marston)
+* Deprecate `RSpec::Core::ExampleGroup.describes` in favor of
+ `RSpec::Core::ExampleGroup.described_class`. (Myron Marston)
+* Deprecate `RSpec::Core::ExampleGroup.alias_example_to` in favor of
+ `RSpec::Core::Configuration#alias_example_to`. (Myron Marston)
+* Deprecate `RSpec::Core::ExampleGroup.alias_it_behaves_like_to` in favor
+ of `RSpec::Core::Configuration#alias_it_behaves_like_to`. (Myron Marston)
+* Deprecate `RSpec::Core::ExampleGroup.focused` in favor of
+ `RSpec::Core::ExampleGroup.focus`. (Myron Marston)
+* Add deprecation warning for `config.filter_run :focused` since
+ example aliases `fit` and `focus` will no longer include
+ `:focused` metadata but will continue to include `:focus`. (Myron Marston)
+* Deprecate filtering by `:line_number` (e.g. `--line-number` from the
+ CLI). Use location filtering instead. (Myron Marston)
+* Deprecate `--default_path` as an alternative to `--default-path`. (Jon Rowe)
+* Deprecate `RSpec::Core::Configuration#warnings` in favor of
+ `RSpec::Core::Configuration#warnings?`. (Myron Marston)
+* Deprecate `share_examples_for` in favor of `shared_examples_for` or
+ just `shared_examples`. (Myron Marston)
+* Deprecate `RSpec::Core::CommandLine` in favor of
+ `RSpec::Core::Runner`. (Myron Marston)
+* Deprecate `#color_enabled`, `#color_enabled=` and `#color?` in favour of
+ `#color`, `#color=` and `#color_enabled? output`. (Jon Rowe)
+* Deprecate `#filename_pattern` in favour of `#pattern`. (Jon Rowe)
+* Deprecate `#backtrace_cleaner` in favour of `#backtrace_formatter`. (Jon Rowe)
+* Deprecate mutating `RSpec::Configuration#formatters`. (Jon Rowe)
+* Deprecate `stdlib` as an available expectation framework in favour of
+ `test_unit` and `minitest`. (Aaron Kromer)
+
+Bug Fixes:
+
+* Issue a warning when you set `config.deprecation_stream` too late for
+ it to take effect because the reporter has already been setup. (Myron Marston)
+* `skip` with a block should not execute the block. (Xavier Shay)
+
+### 2.99.0.beta2 / 2014-02-17
+[Full Changelog](http://github.com/rspec/rspec-core/compare/v2.99.0.beta1...v2.99.0.beta2)
+
+Enhancements:
+
+* Add `is_expected` for one-liners that read well with the
+ `expect`-based syntax. `is_expected` is simply defined as
+ `expect(subject)` and can be used in an expression like:
+ `it { is_expected.to read_well }`. (Myron Marston)
+* Backport `skip` from RSpec 3, which acts like `pending` did in RSpec 2
+ when not given a block, since the behavior of `pending` is changing in
+ RSpec 3. (Xavier Shay)
+
+Deprecations:
+
+* Deprecate inexact `mock_with` config options. RSpec 3 will only support
+ the exact symbols `:rspec`, `:mocha`, `:flexmock`, `:rr` or `:nothing`
+ (or any module that implements the adapter interface). RSpec 2 did
+ fuzzy matching but this will not be supported going forward.
+ (Myron Marston)
+* Deprecate `show_failures_in_pending_blocks` config option. To achieve
+ the same behavior as the option enabled, you can use a custom
+ formatter instead. (Xavier Shay)
+* Add a deprecation warning for the fact that the behavior of `pending`
+ is changing in RSpec 3 -- rather than skipping the example (as it did
+ in 2.x when no block was provided), it will run the example and mark
+ it as failed if no exception is raised. Use `skip` instead to preserve
+ the old behavior. (Xavier Shay)
+* Deprecate 's', 'n', 'spec' and 'nested' as aliases for documentation
+ formatter. (Jon Rowe)
+* Deprecate `RSpec::Core::Reporter#abort` in favor of
+ `RSpec::Core::Reporter#finish`. (Jon Rowe)
+
+Bug Fixes:
+
+* Fix failure (undefined method `path`) in end-of-run summary
+ when `raise_errors_for_deprecations!` is configured. (Myron Marston)
+* Fix issue were overridding spec ordering from the command line wasn't
+ fully recognised interally. (Jon Rowe)
+
+### 2.99.0.beta1 / 2013-11-07
+[Full Changelog](http://github.com/rspec/rspec-core/compare/v2.14.7...v2.99.0.beta1)
+
+Enhancements
+
+* Block-based DSL methods that run in the context of an example
+ (`it`, `before(:each)`, `after(:each)`, `let` and `subject`)
+ now yield the example as a block argument. (David Chelimsky)
+* Warn when the name of more than one example group is submitted to
+ `include_examples` and it's aliases. (David Chelimsky)
+* Add `expose_current_running_example_as` config option for
+ use during the upgrade process when external gems use the
+ deprecated `RSpec::Core::ExampleGroup#example` and
+ `RSpec::Core::ExampleGroup#running_example` methods. (Myron Marston)
+* Limit spamminess of deprecation messages. (Bradley Schaefer, Loren Segal)
+* Add `config.raise_errors_for_deprecations!` option, which turns
+ deprecations warnings into errors to surface the full backtrace
+ of the call site. (Myron Marston)
+
+Deprecations
+
+* Deprecate `RSpec::Core::ExampleGroup#example` and
+ `RSpec::Core::ExampleGroup#running_example` methods. If you need
+ access to the example (e.g. to get its metadata), use a block argument
+ instead. (David Chelimsky)
+* Deprecate use of `autotest/rspec2` in favour of `rspec-autotest`. (Jon Rowe)
+* Deprecate RSpec's built-in debugger support. Use a CLI option like
+ `-rruby-debug` (for the ruby-debug gem) or `-rdebugger` (for the
+ debugger gem) instead. (Myron Marston)
+* Deprecate `RSpec.configuration.treat_symbols_as_metadata_keys_with_true_values = false`.
+ RSpec 3 will not support having this option set to `false`. (Myron Marston)
+* Deprecate accessing a `let` or `subject` declaration in
+ a `after(:all)` hook. (Myron Marston, Jon Rowe)
+* Deprecate built-in `its` usage in favor of `rspec-its` gem due to planned
+ removal in RSpec 3. (Peter Alfvin)
+* Deprecate `RSpec::Core::PendingExampleFixedError` in favor of
+ `RSpec::Core::Pending::PendingExampleFixedError`. (Myron Marston)
+* Deprecate `RSpec::Core::Configuration#out` and
+ `RSpec::Core::Configuration#output` in favor of
+ `RSpec::Core::Configuration#output_stream`. (Myron Marston)
+* Deprecate legacy ordering APIs.
+ * You should use `register_ordering(:global)` instead of these:
+ * `RSpec::Core::Configuration#order_examples`
+ * `RSpec::Core::Configuration#order_groups`
+ * `RSpec::Core::Configuration#order_groups_and_examples`
+ * These are deprecated with no replacement because in RSpec 3
+ ordering is a property of individual example groups rather than
+ just a global property of the entire test suite:
+ * `RSpec::Core::Configuration#order`
+ * `RSpec::Core::Configuration#randomize?`
+ * `--order default` is deprecated in favor of `--order defined`
+ (Myron Marston)
+
+### 2.14.8 / 2014-02-27
+[Full Changelog](http://github.com/rspec/rspec-core/compare/v2.14.7...v2.14.8)
+
+Bug fixes:
+
+* Fix regression with the `textmateformatter` that prevented backtrace links
+ from being clickable. (Stefan Daschek)
+
+### 2.14.7 / 2013-10-29
+[Full Changelog](http://github.com/rspec/rspec-core/compare/v2.14.6...v2.14.7)
+
+Bug fixes:
+
+* Fix regression in 2.14.6 that broke the Fivemat formatter.
+ It depended upon either
+ `example.execution_result[:exception].pending_fixed?` (which
+ was removed in 2.14.6 to fix an issue with frozen error objects)
+ or `RSpec::Core::PendingExampleFixedError` (which was renamed
+ to `RSpec::Core::Pending::PendingExampleFixedError` in 2.8.
+ This fix makes a constant alias for the old error name.
+ (Myron Marston)
+
+### 2.14.6 / 2013-10-15
+[Full Changelog](http://github.com/rspec/rspec-core/compare/v2.14.5...v2.14.6)
+
+Bug fixes:
+
+* Format stringified numbers correctly when mathn library is loaded.
+ (Jay Hayes)
+* Fix an issue that prevented the use of frozen error objects. (Lars
+ Gierth)
+
+### 2.14.5 / 2013-08-13
+[Full Changelog](http://github.com/rspec/rspec-core/compare/v2.14.4...v2.14.5)
+
+Bug fixes:
+
+* Fix a `NoMethodError` that was being raised when there were no shared
+ examples or contexts declared and `RSpec.world.reset` is invoked.
+ (thepoho, Jon Rowe, Myron Marston)
+* Fix a deprecation warning that was being incorrectly displayed when
+ `shared_examples` are declared at top level in a `module` scope.
+ (Jon Rowe)
+* Fix after(:all) hooks so consecutive (same context) scopes will run even if
+ one raises an error. (Jon Rowe, Trejkaz)
+* JsonFormatter no longer dies if `dump_profile` isn't defined (Alex / @MasterLambaster, Jon Rowe)
+
+### 2.14.4 / 2013-07-21
+[Full Changelog](http://github.com/rspec/rspec-core/compare/v2.14.3...v2.14.4)
+
+Bug fixes
+
+* Fix regression in 2.14: ensure configured requires (via `-r` option)
+ are loaded before spec files are loaded. This allows the spec files
+ to programatically change the file pattern (Jon Rowe).
+* Autoload `RSpec::Mocks` and `RSpec::Expectations` when referenced if
+ they are not already loaded (`RSpec::Matches` has been autoloaded
+ for a while). In the `rspec` gem, we changed it recently to stop
+ loading `rspec/mocks` and `rspec/expectations` by default, as some
+ users reported problems where they were intending to use mocha,
+ not rspec-mocks, but rspec-mocks was loaded and causing a conflict.
+ rspec-core loads mocks and expectations at the appropriate time, so
+ it seemed like a safe change -- but caused a problem for some authors
+ of libraries that integrate with RSpec. This fixes that problem.
+ (Myron Marston)
+* Gracefully handle a command like `rspec --profile path/to/spec.rb`:
+ the `path/to/spec.rb` arg was being wrongly treated as the `profile`
+ integer arg, which got cast `0` using `to_i`, causing no profiled
+ examples to be printed. (Jon Rowe)
+
+### 2.14.3 / 2013-07-13
+[Full Changelog](http://github.com/rspec/rspec-core/compare/v2.14.2...v2.14.3)
+
+Bug fixes
+
+* Fix deprecation notices issued from `RSpec::Core::RakeTask` so
+ that they work properly when all of rspec-core is not loaded.
+ (This was a regression in 2.14) (Jon Rowe)
+
+### 2.14.2 / 2013-07-09
+[Full Changelog](http://github.com/rspec/rspec-core/compare/v2.14.1...v2.14.2)
+
+Bug fixes
+
+* Fix regression caused by 2.14.1 release: formatters that
+ report that they `respond_to?` a notification, but had
+ no corresponding method would raise an error when registered.
+ The new fix is to just implement `start` on the deprecation
+ formatter to fix the original JRuby/ruby-debug issue.
+ (Jon Rowe)
+
+### 2.14.1 / 2013-07-08
+[Full Changelog](http://github.com/rspec/rspec-core/compare/v2.14.0...v2.14.1)
+
+Bug fixes
+
+* Address deprecation formatter failure when using `ruby-debug` on
+ JRuby: fix `RSpec::Core::Reporter` to not send a notification
+ when the formatter's implementation of the notification method
+ comes from `Kernel` (Alex Portnov, Jon Rowe).
+
+### 2.14.0 / 2013-07-06
+[Full Changelog](http://github.com/rspec/rspec-core/compare/v2.14.0.rc1...v2.14.0)
+
+Enhancements
+
+* Apply focus to examples defined with `fit` (equivalent of
+ `it "description", focus: true`) (Michael de Silva)
+
+Bug fix
+
+* Ensure methods defined by `let` take precedence over others
+ when there is a name collision (e.g. from an included module).
+ (Jon Rowe, Andy Lindeman and Myron Marston)
+
+### 2.14.0.rc1 / 2013-05-27
+[Full Changelog](http://github.com/rspec/rspec-core/compare/v2.13.1...v2.14.0.rc1)
+
+Enhancements
+
+* Improved Windows detection inside Git Bash, for better `--color` handling.
+* Add profiling of the slowest example groups to `--profile` option.
+ The output is sorted by the slowest average example groups.
+* Don't show slow examples if there's a failure and both `--fail-fast`
+ and `--profile` options are used (Paweł Gościcki).
+* Rather than always adding `spec` to the load path, add the configured
+ `--default-path` to the load path (which defaults to `spec`). This
+ better supports folks who choose to put their specs in a different
+ directory (John Feminella).
+* Add some logic to test time duration precision. Make it a
+ function of time, dropping precision as the time increases. (Aaron Kromer)
+* Add new `backtrace_inclusion_patterns` config option. Backtrace lines
+ that match one of these patterns will _always_ be included in the
+ backtrace, even if they match an exclusion pattern, too (Sam Phippen).
+* Support ERB trim mode using the `-` when parsing `.rspec` as ERB
+ (Gabor Garami).
+* Give a better error message when let and subject are called without a block.
+ (Sam Phippen).
+* List the precedence of `.rspec-local` in the configuration documentation
+ (Sam Phippen)
+* Support `{a,b}` shell expansion syntax in `--pattern` option
+ (Konstantin Haase).
+* Add cucumber documentation for --require command line option
+ (Bradley Schaefer)
+* Expose configuration options via config:
+ * `config.libs` returns the libs configured to be added onto the load path
+ * `full_backtrace?` returns the state of the backtrace cleaner
+ * `debug?` returns true when the debugger is loaded
+ * `line_numbers` returns the line numbers we are filtering by (if any)
+ * `full_description` returns the RegExp used to filter descriptions
+ (Jon Rowe)
+* Add setters for RSpec.world and RSpec.configuration (Alex Soulim)
+* Configure ruby's warning behaviour with `--warnings` (Jon Rowe)
+* Fix an obscure issue on old versions of `1.8.7` where `Time.dup` wouldn't
+ allow access to `Time.now` (Jon Rowe)
+* Make `shared_examples_for` context aware, so that keys may be safely reused
+ in multiple contexts without colliding. (Jon Rowe)
+* Add a configurable `deprecation_stream` (Jon Rowe)
+* Publish deprecations through a formatter (David Chelimsky)
+
+Bug fixes
+
+* Make JSON formatter behave the same when it comes to `--profile` as
+ the text formatter (Paweł Gościcki).
+* Fix named subjects so that if an inner group defines a method that
+ overrides the named method, `subject` still retains the originally
+ declared value (Myron Marston).
+* Fix random ordering so that it does not cause `rand` in examples in
+ nested sibling contexts to return the same value (Max Shytikov).
+* Use the new `backtrace_inclusion_patterns` config option to ensure
+ that folks who develop code in a directory matching one of the default
+ exclusion patterns (e.g. `gems`) still get the normal backtrace
+ filtering (Sam Phippen).
+* Fix ordering of `before` hooks so that `before` hooks declared in
+ `RSpec.configure` run before `before` hooks declared in a shared
+ context (Michi Huber and Tejas Dinkar).
+* Fix `Example#full_description` so that it gets filled in by the last
+ matcher description (as `Example#description` already did) when no
+ doc string has been provided (David Chelimsky).
+* Fix the memoized methods (`let` and `subject`) leaking `define_method`
+ as a `public` method. (Thomas Holmes and Jon Rowe) (#873)
+* Fix warnings coming from the test suite. (Pete Higgins)
+
+Deprecations
+
+* Deprecate `Configuration#backtrace_clean_patterns` in favor of
+ `Configuration#backtrace_exclusion_patterns` for greater consistency
+ and symmetry with new `backtrace_inclusion_patterns` config option
+ (Sam Phippen).
+* Deprecate `Configuration#requires=` in favor of using ruby's
+ `require`. Requires specified by the command line can still be
+ accessed by the `Configuration#require` reader. (Bradley Schaefer)
+* Deprecate calling `SharedExampleGroups` defined across sibling contexts
+ (Jon Rowe)
+
+### 2.13.1 / 2013-03-12
+[Full Changelog](http://github.com/rspec/rspec-core/compare/v2.13.0...v2.13.1)
+
+Bug fixes
+
+* Use hook classes as proxies rather than extending hook blocks to support
+ lambdas for before/after/around hooks. (David Chelimsky)
+* Fix regression in 2.13.0 that caused confusing behavior when overriding
+ a named subject with an unnamed subject in an inner group and then
+ referencing the outer group subject's name. The fix for this required
+ us to disallow using `super` in a named subject (which is confusing,
+ anyway -- named subjects create 2 methods, so which method on the
+ parent example group are you `super`ing to?) but `super` in an unnamed
+ subject continues to work (Myron Marston).
+* Do not allow a referenced `let` or `subject` in `before(:all)` to cause
+ other `let` declarations to leak across examples (Myron Marston).
+* Work around odd ruby 1.9 bug with `String#match` that was triggered
+ by passing it a regex from a `let` declaration. For more info, see
+ http://bugs.ruby-lang.org/issues/8059 (Aaron Kromer).
+* Add missing `require 'set'` to `base_text_formatter.rb` (Tom
+ Anderson).
+
+Deprecations
+
+* Deprecate accessing `let` or `subject` declarations in `before(:all)`.
+ These were not intended to be called in a `before(:all)` hook, as
+ they exist to define state that is reset between each example, while
+ `before(:all)` exists to define state that is shared across examples
+ in an example group (Myron Marston).
+
+### 2.13.0 / 2013-02-23
+[Full Changelog](http://github.com/rspec/rspec-core/compare/v2.12.2...v2.13.0)
+
+Enhancements
+
+* Allow `--profile` option to take a count argument that
+ determines the number of slow examples to dump
+ (Greggory Rothmeier).
+* Add `subject!` that is the analog to `let!`. It defines an
+ explicit subject and sets a `before` hook that will invoke
+ the subject (Zubin Henner).
+* Fix `let` and `subject` declaration so that `super`
+ and `return` can be used in them, just like in a normal
+ method. (Myron Marston)
+* Allow output colors to be configured individually.
+ (Charlie Maffitt)
+* Always dump slow examples when `--profile` option is given,
+ even when an example failed (Myron Marston).
+
+Bug fixes
+
+* Don't blow up when dumping error output for instances
+ of anonymous error classes (Myron Marston).
+* Fix default backtrace filters so lines from projects
+ containing "gems" in the name are not filtered, but
+ lines from installed gems still are (Myron Marston).
+* Fix autotest command so that is uses double quotes
+ rather than single quotes for windows compatibility
+ (Jonas Tingeborn).
+* Fix `its` so that uses of `subject` in a `before` or `let`
+ declaration in the parent group continue to reference the
+ parent group's subject. (Olek Janiszewski)
+
+### 2.12.2 / 2012-12-13
+[Full Changelog](http://github.com/rspec/rspec-core/compare/v2.12.1...v2.12.2)
+
+Bug fixes
+
+* Fix `RSpec::Core::RakeTask` so that it is compatible with rake 0.8.7
+ on ruby 1.8.7. We had accidentally broke it in the 2.12 release
+ (Myron Marston).
+* Fix `RSpec::Core::RakeTask` so it is tolerant of the `Rspec` constant
+ for backwards compatibility (Patrick Van Stee)
+
+### 2.12.1 / 2012-12-01
+[Full Changelog](http://github.com/rspec/rspec-core/compare/v2.12.0...v2.12.1)
+
+Bug fixes
+
+* Specs are run even if another at\_exit hook calls `exit`. This allows
+ Test::Unit and RSpec to run together. (Suraj N. Kurapati)
+* Fix full doc string concatenation so that it handles the case of a
+ method string (e.g. "#foo") being nested under a context string
+ (e.g. "when it is tuesday"), so that we get "when it is tuesday #foo"
+ rather than "when it is tuesday#foo". (Myron Marston)
+* Restore public API I unintentionally broke in 2.12.0:
+ `RSpec::Core::Formatters::BaseFormatter#format_backtrce(backtrace, example)`
+ (Myron Marston).
+
+### 2.12.0 / 2012-11-12
+[Full Changelog](http://github.com/rspec/rspec-core/compare/v2.11.1...v2.12.0)
+
+Enhancements
+
+* Add support for custom ordering strategies for groups and examples.
+ (Myron Marston)
+* JSON Formatter (Alex Chaffee)
+* Refactor rake task internals (Sam Phippen)
+* Refactor HtmlFormatter (Pete Hodgson)
+* Autotest supports a path to Ruby that contains spaces (dsisnero)
+* Provide a helpful warning when a shared example group is redefined.
+ (Mark Burns).
+* `--default_path` can be specified as `--default-line`. `--line_number` can be
+ specified as `--line-number`. Hyphens are more idiomatic command line argument
+ separators (Sam Phippen).
+* A more useful error message is shown when an invalid command line option is
+ used (Jordi Polo).
+* Add `format_docstrings { |str| }` config option. It can be used to
+ apply formatting rules to example group and example docstrings.
+ (Alex Tan)
+* Add support for an `.rspec-local` options file. This is intended to
+ allow individual developers to set options in a git-ignored file that
+ override the common project options in `.rspec`. (Sam Phippen)
+* Support for mocha 0.13.0. (Andy Lindeman)
+
+Bug fixes
+
+* Remove override of `ExampleGroup#ancestors`. This is a core ruby method that
+ RSpec shouldn't override. Instead, define `ExampleGroup#parent_groups`. (Myron
+ Marston)
+* Limit monkey patching of shared example/context declaration methods
+ (`shared_examples_for`, etc.) to just the objects that need it rather than
+ every object in the system (Myron Marston).
+* Fix Metadata#fetch to support computed values (Sam Goldman).
+* Named subject can now be referred to from within subject block in a nested
+ group (tomykaira).
+* Fix `fail_fast` so that it properly exits when an error occurs in a
+ `before(:all) hook` (Bradley Schaefer).
+* Make the order spec files are loaded consistent, regardless of the
+ order of the files returned by the OS or the order passed at
+ the command line (Jo Liss and Sam Phippen).
+* Ensure instance variables from `before(:all)` are always exposed
+ from `after(:all)`, even if an error occurs in `before(:all)`
+ (Sam Phippen).
+* `rspec --init` no longer generates an incorrect warning about `--configure`
+ being deprecated (Sam Phippen).
+* Fix pluralization of `1 seconds` (Odin Dutton)
+* Fix ANSICON url (Jarmo Pertman)
+* Use dup of Time so reporting isn't clobbered by examples that modify Time
+ without properly restoring it. (David Chelimsky)
+
+Deprecations
+
+* `share_as` is no longer needed. `shared_context` and/or
+ `RSpec::SharedContext` provide better mechanisms (Sam Phippen).
+* Deprecate `RSpec.configuration` with a block (use `RSpec.configure`).
+
+
+### 2.11.1 / 2012-07-18
+[Full Changelog](http://github.com/rspec/rspec-core/compare/v2.11.0...v2.11.1)
+
+Bug fixes
+
+* Fix the way we autoload RSpec::Matchers so that custom matchers can be
+ defined before rspec-core has been configured to definitely use
+ rspec-expectations. (Myron Marston)
+* Fix typo in --help message printed for -e option. (Jo Liss)
+* Fix ruby warnings. (Myron Marston)
+* Ignore mock expectation failures when the example has already failed.
+ Mock expectation failures have always been ignored in this situation,
+ but due to my changes in 27059bf1 it was printing a confusing message.
+ (Myron Marston).
+
+### 2.11.0 / 2012-07-07
+[Full Changelog](http://github.com/rspec/rspec-core/compare/v2.10.1...v2.11.0)
+
+Enhancements
+
+* Support multiple `--example` options. (Daniel Doubrovkine @dblock)
+* Named subject e.g. `subject(:article) { Article.new }`
+ * see [http://blog.davidchelimsky.net/2012/05/13/spec-smell-explicit-use-of-subject/](http://blog.davidchelimsky.net/2012/05/13/spec-smell-explicit-use-of-subject/)
+ for background.
+ * thanks to Bradley Schaefer for suggesting it and Avdi Grimm for almost
+ suggesting it.
+* `config.mock_with` and `config.expect_with` yield custom config object to a
+ block if given
+ * aids decoupling from rspec-core's configuation
+* `include_context` and `include_examples` support a block, which gets eval'd
+ in the current context (vs the nested context generated by `it_behaves_like`).
+* Add `config.order = 'random'` to the `spec_helper.rb` generated by `rspec
+ --init`.
+* Delay the loading of DRb (Myron Marston).
+* Limit monkey patching of `describe` onto just the objects that need it rather
+ than every object in the system (Myron Marston).
+
+Bug fixes
+
+* Support alternative path separators. For example, on Windows, you can now do
+ this: `rspec spec\subdir`. (Jarmo Pertman @jarmo)
+* When an example raises an error and an after or around hook does as
+ well, print out the hook error. Previously, the error was silenced and
+ the user got no feedback about what happened. (Myron Marston)
+* `--require` and `-I` are merged among different configuration sources (Andy
+ Lindeman)
+* Delegate to mocha methods instead of aliasing them in mocha adapter.
+
+### 2.10.1 / 2012-05-19
+[Full Changelog](http://github.com/rspec/rspec-core/compare/v2.10.0...v2.10.1)
+
+Bug fixes
+
+* `RSpec.reset` properly reinits configuration and world
+* Call `to_s` before `split` on exception messages that might not always be
+ Strings (slyphon)
+
+### 2.10.0 / 2012-05-03
+[Full Changelog](http://github.com/rspec/rspec-core/compare/v2.9.0...v2.10.0)
+
+Enhancements
+
+* Add `prepend_before` and `append_after` hooks (preethiramdev)
+ * intended for extension libs
+ * restores rspec-1 behavior
+* Reporting of profiled examples (moro)
+ * Report the total amount of time taken for the top slowest examples.
+ * Report what percentage the slowest examples took from the total runtime.
+
+Bug fixes
+
+* Properly parse `SPEC_OPTS` options.
+* `example.description` returns the location of the example if there is no
+ explicit description or matcher-generated description.
+* RDoc fixes (Grzegorz Świrski)
+* Do not modify example ancestry when dumping errors (Michael Grosser)
+
+### 2.9.0 / 2012-03-17
+[Full Changelog](http://github.com/rspec/rspec-core/compare/v2.8.0...v2.9.0)
+
+Enhancements
+
+* Support for "X minutes X seconds" spec run duration in formatter. (uzzz)
+* Strip whitespace from group and example names in doc formatter.
+* Removed spork-0.9 shim. If you're using spork-0.8.x, you'll need to upgrade
+ to 0.9.0.
+
+Bug fixes
+
+* Restore `--full_backtrace` option
+* Ensure that values passed to `config.filter_run` are respected when running
+ over DRb (using spork).
+* Ensure shared example groups are reset after a run (as example groups are).
+* Remove `rescue false` from calls to filters represented as Procs
+* Ensure `described_class` gets the closest constant (pyromaniac)
+* In "autorun", don't run the specs in the `at_exit` hook if there was an
+ exception (most likely due to a SyntaxError). (sunaku)
+* Don't extend groups with modules already used to extend ancestor groups.
+* `its` correctly memoizes nil or false values (Yamada Masaki)
+
+### 2.8.0 / 2012-01-04
+
+[Full Changelog](http://github.com/rspec/rspec-core/compare/v2.8.0.rc2...v2.8.0)
+
+Bug fixes
+
+* For metadata filtering, restore passing the entire array to the proc, rather
+ than each item in the array (weidenfreak)
+* Ensure each spec file is loaded only once
+ * Fixes a bug that caused all the examples in a file to be run when
+ referenced twice with line numbers in a command, e.g.
+ * `rspec path/to/file:37 path/to/file:42`
+
+### 2.8.0.rc2 / 2011-12-19
+
+[Full Changelog](http://github.com/rspec/rspec-core/compare/v2.8.0.rc1...v2.8.0.rc2)
+
+Enhancments
+
+* new `--init` command (Peter Schröder)
+ * generates `spec/spec_helper.rb`
+ * deletes obsolete files (on confirmation)
+ * merged with and deprecates `--configure` command, which generated
+ `.rspec`
+* use `require_relative` when available (Ian Leitch)
+* `include_context` and `include_examples` accept params (Calvin Bascom)
+* print the time for every example in the html formatter (Richie Vos)
+* several tasty refactoring niblets (Sasha)
+* `it "does something", :x => [:foo,'bar',/baz/] (Ivan Neverov)
+ * supports matching n command line tag values with an example or group
+
+### 2.8.0.rc1 / 2011-11-06
+
+[Full Changelog](http://github.com/rspec/rspec-core/compare/v2.7.1...v2.8.0.rc1)
+
+Enhancements
+
+* `--order` (Justin Ko)
+ * run examples in random order: `--order rand`
+ * specify the seed: `--order rand:123`
+* `--seed SEED`
+ * equivalent of `--order rand:SEED`
+* SharedContext supports `let` (David Chelimsky)
+* Filter improvements (David Chelimsky)
+ * override opposing tags from the command line
+ * override RSpec.configure tags from the command line
+ * `--line_number 37` overrides all other filters
+ * `path/to/file.rb:37` overrides all other filters
+ * refactor: consolidate filter management in a FilterManger object
+* Eliminate Ruby warnings (Matijs van Zuijlen)
+* Make reporter.report an API (David Chelimsky)
+ * supports extension tools like interative_rspec
+
+Changes
+
+* change `config.color_enabled` (getter/setter/predicate) to `color` to align
+ with `--[no]-color` CLI option.
+ * `color_enabled` is still supported for now, but will likley be deprecated
+ in a 2.x release so we can remove it in 3.0.
+
+Bug fixes
+
+* Make sure the `bar` in `--tag foo:bar` makes it to DRb (Aaron Gibralter)
+* Fix bug where full descriptions of groups nested 3 deep were repeated.
+* Restore report of time to run to start after files are loaded.
+ * fixes bug where run times were cumalitive in spork
+ * fixes compatibility with time-series metrics
+* Don't error out when `config.mock_with` or `expect_with` is re-specifying the
+ current config (Myron Marston)
+
+* Deprecations
+ * :alias option on `configuration.add_setting`. Use `:alias_with` on the
+ original setting declaration instead.
+
+### 2.7.1 / 2011-10-20
+
+[Full Changelog](http://github.com/rspec/rspec-core/compare/v2.7.0...v2.7.1)
+
+Bug fixes
+
+* tell autotest the correct place to find the rspec executable
+
+### 2.7.0 / 2011-10-16
+
+[Full Changelog](http://github.com/rspec/rspec-core/compare/v2.6.4...v2.7.0)
+
+NOTE: RSpec's release policy dictates that there should not be any backward
+incompatible changes in minor releases, but we're making an exception to
+release a change to how RSpec interacts with other command line tools.
+
+As of 2.7.0, you must explicity `require "rspec/autorun"` unless you use the
+`rspec` command (which already does this for you).
+
+Enhancements
+
+* Add `example.exception` (David Chelimsky)
+* `--default_path` command line option (Justin Ko)
+* support multiple `--line_number` options (David J. Hamilton)
+ * also supports `path/to/file.rb:5:9` (runs examples on lines 5 and 9)
+* Allow classes/modules to be used as shared example group identifiers (Arthur
+ Gunn)
+* Friendly error message when shared context cannot be found (Sławosz
+ Sławiński)
+* Clear formatters when resetting config (John Bintz)
+* Add `xspecify` and xexample as temp-pending methods (David Chelimsky)
+* Add `--no-drb` option (Iain Hecker)
+* Provide more accurate run time by registering start time before code is
+ loaded (David Chelimsky)
+ * reverted in 2.8.0
+* Rake task default pattern finds specs in symlinked dirs (Kelly Felkins)
+* Rake task no longer does anything to invoke bundler since Bundler already
+ handles it for us. Thanks to Andre Arko for the tip.
+* Add `--failure-exit-code` option (Chris Griego)
+
+Bug fixes
+
+* Include `Rake::DSL` to remove deprecation warnings in Rake > 0.8.7 (Pivotal
+ Casebook)
+* Only eval `let` block once even if it returns `nil` (Adam Meehan)
+* Fix `--pattern` option (wasn't being recognized) (David Chelimsky)
+* Only implicitly `require "rspec/autorun"` with the `rspec` command (David
+ Chelimsky)
+* Ensure that rspec's `at_exit` defines the exit code (Daniel Doubrovkine)
+* Show the correct snippet in the HTML and TextMate formatters (Brian Faherty)
+
+### 2.6.4 / 2011-06-06
+
+[Full Changelog](http://github.com/rspec/rspec-core/compare/v2.6.3...v2.6.4)
+
+NOTE: RSpec's release policy dictates that there should not be new
+functionality in patch releases, but this minor enhancement slipped in by
+accident. As it doesn't add a new API, we decided to leave it in rather than
+roll back this release.
+
+Enhancements
+
+* Add summary of commands to run individual failed examples.
+
+Bug fixes
+
+* Support exclusion filters in DRb. (Yann Lugrin)
+* Fix --example escaping when run over DRb. (Elliot Winkler)
+* Use standard ANSI codes for color formatting so colors work in a wider set of
+ color schemes.
+
+### 2.6.3 / 2011-05-24
+
+[Full Changelog](http://github.com/rspec/rspec-core/compare/v2.6.2...v2.6.3)
+
+Bug fixes
+
+* Explicitly convert exit code to integer, avoiding TypeError when return
+ value of run is IO object proxied by `DRb::DRbObject` (Julian Scheid)
+* Clarify behavior of `--example` command line option
+* Build using a rubygems-1.6.2 to avoid downstream yaml parsing error
+
+### 2.6.2 / 2011-05-21
+
+[Full Changelog](http://github.com/rspec/rspec-core/compare/v2.6.1...v2.6.2)
+
+Bug fixes
+
+* Warn rather than raise when HOME env var is not defined
+* Properly merge command-line exclusions with default :if and :unless (joshcooper)
+
+### 2.6.1 / 2011-05-19
+
+[Full Changelog](http://github.com/rspec/rspec-core/compare/v2.6.0...v2.6.1)
+
+Bug fixes
+
+* Don't extend nil when filters are nil
+* `require 'rspec/autorun'` when running rcov.
+
+### 2.6.0 / 2011-05-12
+
+[Full Changelog](http://github.com/rspec/rspec-core/compare/v2.5.1...v2.6.0)
+
+Enhancements
+
+* `shared_context` (Damian Nurzynski)
+ * extend groups matching specific metadata with:
+ * method definitions
+ * subject declarations
+ * let/let! declarations
+ * etc (anything you can do in a group)
+* `its([:key])` works for any subject with #[]. (Peter Jaros)
+* `treat_symbols_as_metadata_keys_with_true_values` (Myron Marston)
+* Print a deprecation warning when you configure RSpec after defining an
+ example. All configuration should happen before any examples are defined.
+ (Myron Marston)
+* Pass the exit status of a DRb run to the invoking process. This causes specs
+ run via DRb to not just return true or false. (Ilkka Laukkanen)
+* Refactoring of `ConfigurationOptions#parse_options` (Rodrigo Rosenfeld Rosas)
+* Report excluded filters in runner output (tip from andyl)
+* Clean up messages for filters/tags.
+* Restore --pattern/-P command line option from rspec-1
+* Support false as well as true in config.full_backtrace= (Andreas Tolf
+ Tolfsen)
+
+Bug fixes
+
+* Don't stumble over an exception without a message (Hans Hasselberg)
+* Remove non-ascii characters from comments that were choking rcov (Geoffrey
+ Byers)
+* Fixed backtrace so it doesn't include lines from before the autorun at_exit
+ hook (Myron Marston)
+* Include RSpec::Matchers when first example group is defined, rather than just
+ before running the examples. This works around an obscure bug in ruby 1.9
+ that can cause infinite recursion. (Myron Marston)
+* Don't send `example_group_[started|finished]` to formatters for empty groups.
+* Get specs passing on jruby (Sidu Ponnappa)
+* Fix bug where mixing nested groups and outer-level examples gave
+ unpredictable :line_number behavior (Artur Małecki)
+* Regexp.escape the argument to --example (tip from Elliot Winkler)
+* Correctly pass/fail pending block with message expectations
+* CommandLine returns exit status (0/1) instead of true/false
+* Create path to formatter output file if it doesn't exist (marekj).
+
+
+### 2.5.1 / 2011-02-06
+
+[Full Changelog](http://github.com/rspec/rspec-core/compare/v2.5.0...v2.5.1)
+
+NOTE: this release breaks compatibility with rspec/autotest/bundler
+integration, but does so in order to greatly simplify it.
+
+With this release, if you want the generated autotest command to include
+'bundle exec', require Autotest's bundler plugin in a .autotest file in the
+project's root directory or in your home directory:
+
+ require "autotest/bundler"
+
+Now you can just type 'autotest' on the commmand line and it will work as you expect.
+
+If you don't want 'bundle exec', there is nothing you have to do.
+
+### 2.5.0 / 2011-02-05
+
+[Full Changelog](http://github.com/rspec/rspec-core/compare/v2.4.0...v2.5.0)
+
+Enhancements
+
+* Autotest::Rspec2 parses command line args passed to autotest after '--'
+* --skip-bundler option for autotest command
+* Autotest regexp fixes (Jon Rowe)
+* Add filters to html and textmate formatters (Daniel Quimper)
+* Explicit passing of block (need for JRuby 1.6) (John Firebaugh)
+
+Bug fixes
+
+* fix dom IDs in HTML formatter (Brian Faherty)
+* fix bug with --drb + formatters when not running in drb
+* include --tag options in drb args (monocle)
+* fix regression so now SPEC_OPTS take precedence over CLI options again (Roman
+ Chernyatchik)
+* only call its(:attribute) once (failing example from Brian Dunn)
+* fix bizarre bug where rspec would hang after String.alias :to_int :to_i
+ (Damian Nurzynski)
+
+Deprecations
+
+* implicit inclusion of 'bundle exec' when Gemfile present (use autotest's
+ bundler plugin instead)
+
+### 2.4.0 / 2011-01-02
+
+[Full Changelog](http://github.com/rspec/rspec-core/compare/v2.3.1...v2.4.0)
+
+Enhancements
+
+* start the debugger on -d so the stack trace is visible when it stops
+ (Clifford Heath)
+* apply hook filtering to examples as well as groups (Myron Marston)
+* support multiple formatters, each with their own output
+* show exception classes in failure messages unless they come from RSpec
+ matchers or message expectations
+* before(:all) { pending } sets all examples to pending
+
+Bug fixes
+
+* fix bug due to change in behavior of reject in Ruby 1.9.3-dev (Shota
+ Fukumori)
+* fix bug when running in jruby: be explicit about passing block to super (John
+ Firebaugh)
+* rake task doesn't choke on paths with quotes (Janmejay Singh)
+* restore --options option from rspec-1
+* require 'ostruct' to fix bug with its([key]) (Kim Burgestrand)
+* --configure option generates .rspec file instead of autotest/discover.rb
+
+### 2.3.1 / 2010-12-16
+
+[Full Changelog](http://github.com/rspec/rspec-core/compare/v2.3.0...v2.3.1)
+
+Bug fixes
+
+* send debugger warning message to $stdout if RSpec.configuration.error_stream
+ has not been defined yet.
+* HTML Formatter _finally_ properly displays nested groups (Jarmo Pertman)
+* eliminate some warnings when running RSpec's own suite (Jarmo Pertman)
+
+### 2.3.0 / 2010-12-12
+
+[Full Changelog](http://github.com/rspec/rspec-core/compare/v2.2.1...v2.3.0)
+
+Enhancements
+
+* tell autotest to use "rspec2" if it sees a .rspec file in the project's root
+ directory
+ * replaces the need for ./autotest/discover.rb, which will not work with
+ all versions of ZenTest and/or autotest
+* config.expect_with
+ * :rspec # => rspec/expectations
+ * :stdlib # => test/unit/assertions
+ * :rspec, :stdlib # => both
+
+Bug fixes
+
+* fix dev Gemfile to work on non-mac-os machines (Lake Denman)
+* ensure explicit subject is only eval'd once (Laszlo Bacsi)
+
+### 2.2.1 / 2010-11-28
+
+[Full Changelog](http://github.com/rspec/rspec-core/compare/v2.2.0...v2.2.1)
+
+Bug fixes
+* alias_method instead of override Kernel#method_missing (John Wilger)
+* changed --autotest to --tty in generated command (MIKAMI Yoshiyuki)
+* revert change to debugger (had introduced conflict with Rails)
+ * also restored --debugger/-debug option
+
+### 2.2.0 / 2010-11-28
+
+[Full Changelog](http://github.com/rspec/rspec-core/compare/v2.1.0...v2.2.0)
+
+Deprecations/changes
+
+* --debug/-d on command line is deprecated and now has no effect
+* win32console is now ignored; Windows users must use ANSICON for color support
+ (Bosko Ivanisevic)
+
+Enhancements
+
+* When developing locally rspec-core now works with the rspec-dev setup or your
+ local gems
+* Raise exception with helpful message when rspec-1 is loaded alongside rspec-2
+ (Justin Ko)
+* debugger statements _just work_ as long as ruby-debug is installed
+ * otherwise you get warned, but not fired
+* Expose example.metadata in around hooks
+* Performance improvments (much faster now)
+
+Bug fixes
+
+* Make sure --fail-fast makes it across drb
+* Pass -Ilib:spec to rcov
+
+### 2.1.0 / 2010-11-07
+
+[Full Changelog](http://github.com/rspec/rspec-core/compare/v2.0.1...v2.1.0)
+
+Enhancments
+
+* Add skip_bundler option to rake task to tell rake task to ignore the presence
+ of a Gemfile (jfelchner)
+* Add gemfile option to rake task to tell rake task what Gemfile to look for
+ (defaults to 'Gemfile')
+* Allow passing caller trace into Metadata to support extensions (Glenn
+ Vanderburg)
+* Add deprecation warning for Spec::Runner.configure to aid upgrade from
+ RSpec-1
+* Add deprecated Spec::Rake::SpecTask to aid upgrade from RSpec-1
+* Add 'autospec' command with helpful message to aid upgrade from RSpec-1
+* Add support for filtering with tags on CLI (Lailson Bandeira)
+* Add a helpful message about RUBYOPT when require fails in bin/rspec (slyphon)
+* Add "-Ilib" to the default rcov options (Tianyi Cui)
+* Make the expectation framework configurable (default rspec, of course)
+ (Justin Ko)
+* Add 'pending' to be conditional (Myron Marston)
+* Add explicit support for :if and :unless as metadata keys for conditional run
+ of examples (Myron Marston)
+* Add --fail-fast command line option (Jeff Kreeftmeijer)
+
+Bug fixes
+
+* Eliminate stack overflow with "subject { self }"
+* Require 'rspec/core' in the Raketask (ensures it required when running rcov)
+
+### 2.0.1 / 2010-10-18
+
+[Full Changelog](http://github.com/rspec/rspec-core/compare/v2.0.0...v2.0.1)
+
+Bug fixes
+
+* Restore color when using spork + autotest
+* Pending examples without docstrings render the correct message (Josep M.
+ Bach)
+* Fixed bug where a failure in a spec file ending in anything but _spec.rb
+ would fail in a confusing way.
+* Support backtrace lines from erb templates in html formatter (Alex Crichton)
+
+### 2.0.0 / 2010-10-10
+
+[Full Changelog](http://github.com/rspec/rspec-core/compare/v2.0.0.rc...v2.0.0)
+
+RSpec-1 compatibility
+
+* Rake task uses ENV["SPEC"] as file list if present
+
+Bug fixes
+
+* Bug Fix: optparse --out foo.txt (Leonardo Bessa)
+* Suppress color codes for non-tty output (except autotest)
+
+### 2.0.0.rc / 2010-10-05
+
+[Full Changelog](http://github.com/rspec/rspec-core/compare/v2.0.0.beta.22...v2.0.0.rc)
+
+Enhancements
+
+* implicitly require unknown formatters so you don't have to require the file
+ explicitly on the commmand line (Michael Grosser)
+* add --out/-o option to assign output target
+* added fail_fast configuration option to abort on first failure
+* support a Hash subject (its([:key]) { should == value }) (Josep M. Bach)
+
+Bug fixes
+
+* Explicitly require rspec version to fix broken rdoc task (Hans de Graaff)
+* Ignore backtrace lines that come from other languages, like Java or
+ Javascript (Charles Lowell)
+* Rake task now does what is expected when setting (or not setting)
+ fail_on_error and verbose
+* Fix bug in which before/after(:all) hooks were running on excluded nested
+ groups (Myron Marston)
+* Fix before(:all) error handling so that it fails examples in nested groups,
+ too (Myron Marston)
+
+### 2.0.0.beta.22 / 2010-09-12
+
+[Full Changelog](http://github.com/rspec/rspec-core/compare/v2.0.0.beta.20...v2.0.0.beta.22)
+
+Enhancements
+
+* removed at_exit hook
+* CTRL-C stops the run (almost) immediately
+ * first it cleans things up by running the appropriate after(:all) and
+ after(:suite) hooks
+ * then it reports on any examples that have already run
+* cleaned up rake task
+ * generate correct task under variety of conditions
+ * options are more consistent
+ * deprecated redundant options
+* run 'bundle exec autotest' when Gemfile is present
+* support ERB in .rspec options files (Justin Ko)
+* depend on bundler for development tasks (Myron Marston)
+* add example_group_finished to formatters and reporter (Roman Chernyatchik)
+
+Bug fixes
+
+* support paths with spaces when using autotest (Andreas Neuhaus)
+* fix module_exec with ruby 1.8.6 (Myron Marston)
+* remove context method from top-level
+ * was conflicting with irb, for example
+* errors in before(:all) are now reported correctly (Chad Humphries)
+
+Removals
+
+* removed -o --options-file command line option
+ * use ./.rspec and ~/.rspec
diff --git a/.bundle/gems/rspec-core-3.3.2/License.txt b/.bundle/gems/rspec-core-3.3.2/License.txt
new file mode 100644
index 0000000..4bd202e
--- /dev/null
+++ b/.bundle/gems/rspec-core-3.3.2/License.txt
@@ -0,0 +1,25 @@
+(The MIT License)
+
+Copyright (c) 2012 Chad Humphries, David Chelimsky, Myron Marston
+Copyright (c) 2009 Chad Humphries, David Chelimsky
+Copyright (c) 2006 David Chelimsky, The RSpec Development Team
+Copyright (c) 2005 Steven Baker
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/.bundle/gems/rspec-core-3.3.2/README.md b/.bundle/gems/rspec-core-3.3.2/README.md
new file mode 100644
index 0000000..1045ca6
--- /dev/null
+++ b/.bundle/gems/rspec-core-3.3.2/README.md
@@ -0,0 +1,369 @@
+# rspec-core [](http://travis-ci.org/rspec/rspec-core) [](https://codeclimate.com/github/rspec/rspec-core)
+
+rspec-core provides the structure for writing executable examples of how your
+code should behave, and an `rspec` command with tools to constrain which
+examples get run and tailor the output.
+
+## Install
+
+ gem install rspec # for rspec-core, rspec-expectations, rspec-mocks
+ gem install rspec-core # for rspec-core only
+ rspec --help
+
+Want to run against the `master` branch? You'll need to include the dependent
+RSpec repos as well. Add the following to your `Gemfile`:
+
+```ruby
+%w[rspec rspec-core rspec-expectations rspec-mocks rspec-support].each do |lib|
+ gem lib, :git => "git://github.com/rspec/#{lib}.git", :branch => 'master'
+end
+```
+
+## Basic Structure
+
+RSpec uses the words "describe" and "it" so we can express concepts like a conversation:
+
+ "Describe an order."
+ "It sums the prices of its line items."
+
+```ruby
+RSpec.describe Order do
+ it "sums the prices of its line items" do
+ order = Order.new
+
+ order.add_entry(LineItem.new(:item => Item.new(
+ :price => Money.new(1.11, :USD)
+ )))
+ order.add_entry(LineItem.new(:item => Item.new(
+ :price => Money.new(2.22, :USD),
+ :quantity => 2
+ )))
+
+ expect(order.total).to eq(Money.new(5.55, :USD))
+ end
+end
+```
+
+The `describe` method creates an [ExampleGroup](http://rubydoc.info/gems/rspec-core/RSpec/Core/ExampleGroup). Within the
+block passed to `describe` you can declare examples using the `it` method.
+
+Under the hood, an example group is a class in which the block passed to
+`describe` is evaluated. The blocks passed to `it` are evaluated in the
+context of an _instance_ of that class.
+
+## Nested Groups
+
+You can also declare nested nested groups using the `describe` or `context`
+methods:
+
+```ruby
+RSpec.describe Order do
+ context "with no items" do
+ it "behaves one way" do
+ # ...
+ end
+ end
+
+ context "with one item" do
+ it "behaves another way" do
+ # ...
+ end
+ end
+end
+```
+
+Nested groups are subclasses of the outer example group class, providing
+the inheritance semantics you'd want for free.
+
+## Aliases
+
+You can declare example groups using either `describe` or `context`.
+For a top level example group, `describe` and `context` are available
+off of `RSpec`. For backwards compatibility, they are also available
+off of the `main` object and `Module` unless you disable monkey
+patching.
+
+You can declare examples within a group using any of `it`, `specify`, or
+`example`.
+
+## Shared Examples and Contexts
+
+Declare a shared example group using `shared_examples`, and then include it
+in any group using `include_examples`.
+
+```ruby
+RSpec.shared_examples "collections" do |collection_class|
+ it "is empty when first created" do
+ expect(collection_class.new).to be_empty
+ end
+end
+
+RSpec.describe Array do
+ include_examples "collections", Array
+end
+
+RSpec.describe Hash do
+ include_examples "collections", Hash
+end
+```
+
+Nearly anything that can be declared within an example group can be declared
+within a shared example group. This includes `before`, `after`, and `around`
+hooks, `let` declarations, and nested groups/contexts.
+
+You can also use the names `shared_context` and `include_context`. These are
+pretty much the same as `shared_examples` and `include_examples`, providing
+more accurate naming when you share hooks, `let` declarations, helper methods,
+etc, but no examples.
+
+## Metadata
+
+rspec-core stores a metadata hash with every example and group, which
+contains their descriptions, the locations at which they were
+declared, etc, etc. This hash powers many of rspec-core's features,
+including output formatters (which access descriptions and locations),
+and filtering before and after hooks.
+
+Although you probably won't ever need this unless you are writing an
+extension, you can access it from an example like this:
+
+```ruby
+it "does something" do |example|
+ expect(example.metadata[:description]).to eq("does something")
+end
+```
+
+### `described_class`
+
+When a class is passed to `describe`, you can access it from an example
+using the `described_class` method, which is a wrapper for
+`example.metadata[:described_class]`.
+
+```ruby
+RSpec.describe Widget do
+ example do
+ expect(described_class).to equal(Widget)
+ end
+end
+```
+
+This is useful in extensions or shared example groups in which the specific
+class is unknown. Taking the collections shared example group from above, we can
+clean it up a bit using `described_class`:
+
+```ruby
+RSpec.shared_examples "collections" do
+ it "is empty when first created" do
+ expect(described_class.new).to be_empty
+ end
+end
+
+RSpec.describe Array do
+ include_examples "collections"
+end
+
+RSpec.describe Hash do
+ include_examples "collections"
+end
+```
+
+## A Word on Scope
+
+RSpec has two scopes:
+
+* **Example Group**: Example groups are defined by a `describe` or
+ `context` block, which is eagerly evaluated when the spec file is
+ loaded. The block is evaluated in the context of a subclass of
+ `RSpec::Core::ExampleGroup`, or a subclass of the parent example group
+ when you're nesting them.
+* **Example**: Examples -- typically defined by an `it` block -- and any other
+ blocks with per-example semantics -- such as a `before(:example)` hook -- are
+ evaluated in the context of
+ an _instance_ of the example group class to which the example belongs.
+ Examples are _not_ executed when the spec file is loaded; instead,
+ RSpec waits to run any examples until all spec files have been loaded,
+ at which point it can apply filtering, randomization, etc.
+
+To make this more concrete, consider this code snippet:
+
+``` ruby
+RSpec.describe "Using an array as a stack" do
+ def build_stack
+ []
+ end
+
+ before(:example) do
+ @stack = build_stack
+ end
+
+ it 'is initially empty' do
+ expect(@stack).to be_empty
+ end
+
+ context "after an item has been pushed" do
+ before(:example) do
+ @stack.push :item
+ end
+
+ it 'allows the pushed item to be popped' do
+ expect(@stack.pop).to eq(:item)
+ end
+ end
+end
+```
+
+Under the covers, this is (roughly) equivalent to:
+
+``` ruby
+class UsingAnArrayAsAStack < RSpec::Core::ExampleGroup
+ def build_stack
+ []
+ end
+
+ def before_example_1
+ @stack = build_stack
+ end
+
+ def it_is_initially_empty
+ expect(@stack).to be_empty
+ end
+
+ class AfterAnItemHasBeenPushed < self
+ def before_example_2
+ @stack.push :item
+ end
+
+ def it_allows_the_pushed_item_to_be_popped
+ expect(@stack.pop).to eq(:item)
+ end
+ end
+end
+```
+
+To run these examples, RSpec would (roughly) do the following:
+
+``` ruby
+example_1 = UsingAnArrayAsAStack.new
+example_1.before_example_1
+example_1.it_is_initially_empty
+
+example_2 = UsingAnArrayAsAStack::AfterAnItemHasBeenPushed.new
+example_2.before_example_1
+example_2.before_example_2
+example_2.it_allows_the_pushed_item_to_be_popped
+```
+
+## The `rspec` Command
+
+When you install the rspec-core gem, it installs the `rspec` executable,
+which you'll use to run rspec. The `rspec` command comes with many useful
+options.
+Run `rspec --help` to see the complete list.
+
+## Store Command Line Options `.rspec`
+
+You can store command line options in a `.rspec` file in the project's root
+directory, and the `rspec` command will read them as though you typed them on
+the command line.
+
+## Get Started
+
+Start with a simple example of behavior you expect from your system. Do
+this before you write any implementation code:
+
+```ruby
+# in spec/calculator_spec.rb
+RSpec.describe Calculator do
+ describe '#add' do
+ it 'returns the sum of its arguments' do
+ expect(Calculator.new.add(1, 2)).to eq(3)
+ end
+ end
+end
+```
+
+Run this with the rspec command, and watch it fail:
+
+```
+$ rspec spec/calculator_spec.rb
+./spec/calculator_spec.rb:1: uninitialized constant Calculator
+```
+
+Address the failure by defining a skeleton of the `Calculator` class:
+
+```ruby
+# in lib/calculator.rb
+class Calculator
+ def add(a, b)
+ end
+end
+```
+
+Be sure to require the implementation file in the spec:
+
+```ruby
+# in spec/calculator_spec.rb
+# - RSpec adds ./lib to the $LOAD_PATH
+require "calculator"
+```
+
+Now run the spec again, and watch the expectation fail:
+
+```
+$ rspec spec/calculator_spec.rb
+F
+
+Failures:
+
+ 1) Calculator#add returns the sum of its arguments
+ Failure/Error: expect(Calculator.new.add(1, 2)).to eq(3)
+
+ expected: 3
+ got: nil
+
+ (compared using ==)
+ # ./spec/calcalator_spec.rb:6:in `block (3 levels) in '
+
+Finished in 0.00131 seconds (files took 0.10968 seconds to load)
+1 example, 1 failure
+
+Failed examples:
+
+rspec ./spec/calcalator_spec.rb:5 # Calculator#add returns the sum of its arguments
+```
+
+Implement the simplest solution, by changing the definition of `Calculator#add` to:
+
+```ruby
+def add(a, b)
+ a + b
+end
+```
+
+Now run the spec again, and watch it pass:
+
+```
+$ rspec spec/calculator_spec.rb
+.
+
+Finished in 0.000315 seconds
+1 example, 0 failures
+```
+
+Use the `documentation` formatter to see the resulting spec:
+
+```
+$ rspec spec/calculator_spec.rb --format doc
+Calculator
+ #add
+ returns the sum of its arguments
+
+Finished in 0.000379 seconds
+1 example, 0 failures
+```
+
+## Also see
+
+* [http://github.com/rspec/rspec](http://github.com/rspec/rspec)
+* [http://github.com/rspec/rspec-expectations](http://github.com/rspec/rspec-expectations)
+* [http://github.com/rspec/rspec-mocks](http://github.com/rspec/rspec-mocks)
diff --git a/.bundle/gems/rspec-core-3.3.2/exe/rspec b/.bundle/gems/rspec-core-3.3.2/exe/rspec
new file mode 100755
index 0000000..7ee5fd8
--- /dev/null
+++ b/.bundle/gems/rspec-core-3.3.2/exe/rspec
@@ -0,0 +1,4 @@
+#!/usr/bin/env ruby
+
+require 'rspec/core'
+RSpec::Core::Runner.invoke
diff --git a/.bundle/gems/rspec-core-3.3.2/lib/rspec/autorun.rb b/.bundle/gems/rspec-core-3.3.2/lib/rspec/autorun.rb
new file mode 100644
index 0000000..3080cfd
--- /dev/null
+++ b/.bundle/gems/rspec-core-3.3.2/lib/rspec/autorun.rb
@@ -0,0 +1,3 @@
+require 'rspec/core'
+# Ensure the default config is loaded
+RSpec::Core::Runner.autorun
diff --git a/.bundle/gems/rspec-core-3.3.2/lib/rspec/core.rb b/.bundle/gems/rspec-core-3.3.2/lib/rspec/core.rb
new file mode 100644
index 0000000..ccb424c
--- /dev/null
+++ b/.bundle/gems/rspec-core-3.3.2/lib/rspec/core.rb
@@ -0,0 +1,181 @@
+# rubocop:disable Style/GlobalVars
+$_rspec_core_load_started_at = Time.now
+# rubocop:enable Style/GlobalVars
+
+require "rspec/support"
+RSpec::Support.require_rspec_support "caller_filter"
+
+RSpec::Support.define_optimized_require_for_rspec(:core) { |f| require_relative f }
+
+%w[
+ version
+ warnings
+
+ set
+ flat_map
+ filter_manager
+ dsl
+ notifications
+ reporter
+
+ hooks
+ memoized_helpers
+ metadata
+ metadata_filter
+ pending
+ formatters
+ ordering
+
+ world
+ configuration
+ option_parser
+ configuration_options
+ runner
+ example
+ shared_example_group
+ example_group
+].each { |name| RSpec::Support.require_rspec_core name }
+
+# Namespace for all core RSpec code.
+module RSpec
+ autoload :SharedContext, 'rspec/core/shared_context'
+
+ extend RSpec::Core::Warnings
+
+ class << self
+ # Setters for shared global objects
+ # @api private
+ attr_writer :configuration, :world
+ end
+
+ # Used to ensure examples get reloaded and user configuration gets reset to
+ # defaults between multiple runs in the same process.
+ #
+ # Users must invoke this if they want to have the configuration reset when
+ # they use the runner multiple times within the same process. Users must deal
+ # themselves with re-configuration of RSpec before run.
+ def self.reset
+ @world = nil
+ @configuration = nil
+ end
+
+ # Used to ensure examples get reloaded between multiple runs in the same
+ # process and ensures user configuration is persisted.
+ #
+ # Users must invoke this if they want to clear all examples but preserve
+ # current configuration when they use the runner multiple times within the
+ # same process.
+ def self.clear_examples
+ world.reset
+ configuration.reporter.reset
+ configuration.start_time = ::RSpec::Core::Time.now
+ configuration.reset_filters
+ end
+
+ # Returns the global [Configuration](RSpec/Core/Configuration) object. While
+ # you _can_ use this method to access the configuration, the more common
+ # convention is to use [RSpec.configure](RSpec#configure-class_method).
+ #
+ # @example
+ # RSpec.configuration.drb_port = 1234
+ # @see RSpec.configure
+ # @see Core::Configuration
+ def self.configuration
+ @configuration ||= RSpec::Core::Configuration.new
+ end
+ configuration.expose_dsl_globally = true
+
+ # Yields the global configuration to a block.
+ # @yield [Configuration] global configuration
+ #
+ # @example
+ # RSpec.configure do |config|
+ # config.add_formatter 'documentation'
+ # end
+ # @see Core::Configuration
+ def self.configure
+ yield configuration if block_given?
+ end
+
+ # The example being executed.
+ #
+ # The primary audience for this method is library authors who need access
+ # to the example currently being executed and also want to support all
+ # versions of RSpec 2 and 3.
+ #
+ # @example
+ #
+ # RSpec.configure do |c|
+ # # context.example is deprecated, but RSpec.current_example is not
+ # # available until RSpec 3.0.
+ # fetch_current_example = RSpec.respond_to?(:current_example) ?
+ # proc { RSpec.current_example } : proc { |context| context.example }
+ #
+ # c.before(:example) do
+ # example = fetch_current_example.call(self)
+ #
+ # # ...
+ # end
+ # end
+ #
+ def self.current_example
+ RSpec::Support.thread_local_data[:current_example]
+ end
+
+ # Set the current example being executed.
+ # @api private
+ def self.current_example=(example)
+ RSpec::Support.thread_local_data[:current_example] = example
+ end
+
+ # @private
+ # Internal container for global non-configuration data.
+ def self.world
+ @world ||= RSpec::Core::World.new
+ end
+
+ # Namespace for the rspec-core code.
+ module Core
+ autoload :ExampleStatusPersister, "rspec/core/example_status_persister"
+ autoload :Profiler, "rspec/core/profiler"
+
+ # @private
+ # This avoids issues with reporting time caused by examples that
+ # change the value/meaning of Time.now without properly restoring
+ # it.
+ class Time
+ class << self
+ define_method(:now, &::Time.method(:now))
+ end
+ end
+
+ # @private path to executable file.
+ def self.path_to_executable
+ @path_to_executable ||= File.expand_path('../../../exe/rspec', __FILE__)
+ end
+ end
+
+ # @private
+ MODULES_TO_AUTOLOAD = {
+ :Matchers => "rspec/expectations",
+ :Expectations => "rspec/expectations",
+ :Mocks => "rspec/mocks"
+ }
+
+ # @private
+ def self.const_missing(name)
+ # Load rspec-expectations when RSpec::Matchers is referenced. This allows
+ # people to define custom matchers (using `RSpec::Matchers.define`) before
+ # rspec-core has loaded rspec-expectations (since it delays the loading of
+ # it to allow users to configure a different assertion/expectation
+ # framework). `autoload` can't be used since it works with ruby's built-in
+ # require (e.g. for files that are available relative to a load path dir),
+ # but not with rubygems' extended require.
+ #
+ # As of rspec 2.14.1, we no longer require `rspec/mocks` and
+ # `rspec/expectations` when `rspec` is required, so we want
+ # to make them available as an autoload.
+ require MODULES_TO_AUTOLOAD.fetch(name) { return super }
+ ::RSpec.const_get(name)
+ end
+end
diff --git a/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/backtrace_formatter.rb b/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/backtrace_formatter.rb
new file mode 100644
index 0000000..74617ec
--- /dev/null
+++ b/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/backtrace_formatter.rb
@@ -0,0 +1,64 @@
+module RSpec
+ module Core
+ # @private
+ class BacktraceFormatter
+ # @private
+ attr_accessor :exclusion_patterns, :inclusion_patterns
+
+ def initialize
+ @full_backtrace = false
+
+ patterns = %w[ /lib\d*/ruby/ bin/ exe/rspec ]
+ patterns << "org/jruby/" if RUBY_PLATFORM == 'java'
+ patterns.map! { |s| Regexp.new(s.gsub("/", File::SEPARATOR)) }
+
+ @exclusion_patterns = [Regexp.union(RSpec::CallerFilter::IGNORE_REGEX, *patterns)]
+ @inclusion_patterns = []
+
+ return unless matches?(@exclusion_patterns, File.join(Dir.getwd, "lib", "foo.rb:13"))
+ inclusion_patterns << Regexp.new(Dir.getwd)
+ end
+
+ attr_writer :full_backtrace
+
+ def full_backtrace?
+ @full_backtrace || exclusion_patterns.empty?
+ end
+
+ def filter_gem(gem_name)
+ sep = File::SEPARATOR
+ exclusion_patterns << /#{sep}#{gem_name}(-[^#{sep}]+)?#{sep}/
+ end
+
+ def format_backtrace(backtrace, options={})
+ return backtrace if options[:full_backtrace] || backtrace.empty?
+
+ backtrace.map { |l| backtrace_line(l) }.compact.
+ tap do |filtered|
+ if filtered.empty?
+ filtered.concat backtrace
+ filtered << ""
+ filtered << " Showing full backtrace because every line was filtered out."
+ filtered << " See docs for RSpec::Configuration#backtrace_exclusion_patterns and"
+ filtered << " RSpec::Configuration#backtrace_inclusion_patterns for more information."
+ end
+ end
+ end
+
+ def backtrace_line(line)
+ Metadata.relative_path(line) unless exclude?(line)
+ end
+
+ def exclude?(line)
+ return false if @full_backtrace
+ matches?(exclusion_patterns, line) && !matches?(inclusion_patterns, line)
+ end
+
+ private
+
+ def matches?(patterns, line)
+ patterns.any? { |p| line =~ p }
+ end
+ end
+ end
+end
diff --git a/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/bisect/coordinator.rb b/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/bisect/coordinator.rb
new file mode 100644
index 0000000..16448c1
--- /dev/null
+++ b/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/bisect/coordinator.rb
@@ -0,0 +1,66 @@
+RSpec::Support.require_rspec_core "bisect/server"
+RSpec::Support.require_rspec_core "bisect/runner"
+RSpec::Support.require_rspec_core "bisect/example_minimizer"
+RSpec::Support.require_rspec_core "formatters/bisect_progress_formatter"
+
+module RSpec
+ module Core
+ module Bisect
+ # @private
+ # The main entry point into the bisect logic. Coordinates among:
+ # - Bisect::Server: Receives suite results.
+ # - Bisect::Runner: Runs a set of examples and directs the results
+ # to the server.
+ # - Bisect::ExampleMinimizer: Contains the core bisect logic.
+ # - Formatters::BisectProgressFormatter: provides progress updates
+ # to the user.
+ class Coordinator
+ def self.bisect_with(original_cli_args, configuration, formatter)
+ new(original_cli_args, configuration, formatter).bisect
+ end
+
+ def initialize(original_cli_args, configuration, formatter)
+ @original_cli_args = original_cli_args
+ @configuration = configuration
+ @formatter = formatter
+ end
+
+ def bisect
+ @configuration.add_formatter @formatter
+
+ reporter.close_after do
+ repro = Server.run do |server|
+ runner = Runner.new(server, @original_cli_args)
+ minimizer = ExampleMinimizer.new(runner, reporter)
+
+ gracefully_abort_on_sigint(minimizer)
+ minimizer.find_minimal_repro
+ minimizer.repro_command_for_currently_needed_ids
+ end
+
+ reporter.publish(:bisect_repro_command, :repro => repro)
+ end
+
+ true
+ rescue BisectFailedError => e
+ reporter.publish(:bisect_failed, :failure_explanation => e.message)
+ false
+ end
+
+ private
+
+ def reporter
+ @configuration.reporter
+ end
+
+ def gracefully_abort_on_sigint(minimizer)
+ trap('INT') do
+ repro = minimizer.repro_command_for_currently_needed_ids
+ reporter.publish(:bisect_aborted, :repro => repro)
+ exit(1)
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/bisect/example_minimizer.rb b/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/bisect/example_minimizer.rb
new file mode 100644
index 0000000..f8a6022
--- /dev/null
+++ b/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/bisect/example_minimizer.rb
@@ -0,0 +1,130 @@
+RSpec::Support.require_rspec_core "bisect/subset_enumerator"
+
+module RSpec
+ module Core
+ module Bisect
+ # @private
+ # Contains the core bisect logic. Searches for examples we can ignore by
+ # repeatedly running different subsets of the suite.
+ class ExampleMinimizer
+ attr_reader :runner, :reporter, :all_example_ids, :failed_example_ids
+ attr_accessor :remaining_ids
+
+ def initialize(runner, reporter)
+ @runner = runner
+ @reporter = reporter
+ end
+
+ def find_minimal_repro
+ prep
+
+ self.remaining_ids = non_failing_example_ids
+
+ each_bisect_round do |subsets|
+ ids_to_ignore = subsets.find do |ids|
+ get_expected_failures_for?(remaining_ids - ids)
+ end
+
+ next :done unless ids_to_ignore
+
+ self.remaining_ids -= ids_to_ignore
+ notify(:bisect_ignoring_ids, :ids_to_ignore => ids_to_ignore, :remaining_ids => remaining_ids)
+ end
+
+ currently_needed_ids
+ end
+
+ def currently_needed_ids
+ remaining_ids + failed_example_ids
+ end
+
+ def repro_command_for_currently_needed_ids
+ return runner.repro_command_from(currently_needed_ids) if remaining_ids
+ "(Not yet enough information to provide any repro command)"
+ end
+
+ private
+
+ def prep
+ notify(:bisect_starting, :original_cli_args => runner.original_cli_args)
+
+ _, duration = track_duration do
+ original_results = runner.original_results
+ @all_example_ids = original_results.all_example_ids
+ @failed_example_ids = original_results.failed_example_ids
+ end
+
+ if @failed_example_ids.empty?
+ raise BisectFailedError, "\n\nNo failures found. Bisect only works " \
+ "in the presence of one or more failing examples."
+ else
+ notify(:bisect_original_run_complete, :failed_example_ids => failed_example_ids,
+ :non_failing_example_ids => non_failing_example_ids,
+ :duration => duration)
+ end
+ end
+
+ def non_failing_example_ids
+ @non_failing_example_ids ||= all_example_ids - failed_example_ids
+ end
+
+ def get_expected_failures_for?(ids)
+ ids_to_run = ids + failed_example_ids
+ notify(:bisect_individual_run_start, :command => runner.repro_command_from(ids_to_run))
+
+ results, duration = track_duration { runner.run(ids_to_run) }
+ notify(:bisect_individual_run_complete, :duration => duration, :results => results)
+
+ abort_if_ordering_inconsistent(results)
+ (failed_example_ids & results.failed_example_ids) == failed_example_ids
+ end
+
+ INFINITY = (1.0 / 0) # 1.8.7 doesn't define Float::INFINITY so we define our own...
+
+ def each_bisect_round(&block)
+ last_round, duration = track_duration do
+ 1.upto(INFINITY) do |round|
+ break if :done == bisect_round(round, &block)
+ end
+ end
+
+ notify(:bisect_complete, :round => last_round, :duration => duration,
+ :original_non_failing_count => non_failing_example_ids.size,
+ :remaining_count => remaining_ids.size)
+ end
+
+ def bisect_round(round)
+ value, duration = track_duration do
+ subsets = SubsetEnumerator.new(remaining_ids)
+ notify(:bisect_round_started, :round => round,
+ :subset_size => subsets.subset_size,
+ :remaining_count => remaining_ids.size)
+
+ yield subsets
+ end
+
+ notify(:bisect_round_finished, :duration => duration, :round => round)
+ value
+ end
+
+ def track_duration
+ start = ::RSpec::Core::Time.now
+ [yield, ::RSpec::Core::Time.now - start]
+ end
+
+ def abort_if_ordering_inconsistent(results)
+ expected_order = all_example_ids & results.all_example_ids
+ return if expected_order == results.all_example_ids
+
+ raise BisectFailedError, "\n\nThe example ordering is inconsistent. " \
+ "`--bisect` relies upon consistent ordering (e.g. by passing " \
+ "`--seed` if you're using random ordering) to work properly."
+ end
+
+ def notify(*args)
+ reporter.publish(*args)
+ end
+ end
+ end
+ end
+end
diff --git a/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/bisect/runner.rb b/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/bisect/runner.rb
new file mode 100644
index 0000000..a9d07dc
--- /dev/null
+++ b/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/bisect/runner.rb
@@ -0,0 +1,139 @@
+RSpec::Support.require_rspec_core "shell_escape"
+require 'open3'
+
+module RSpec
+ module Core
+ module Bisect
+ # Provides an API to run the suite for a set of locations, using
+ # the given bisect server to capture the results.
+ # @private
+ class Runner
+ attr_reader :original_cli_args
+
+ def initialize(server, original_cli_args)
+ @server = server
+ @original_cli_args = original_cli_args.reject { |arg| arg.start_with?("--bisect") }
+ end
+
+ def run(locations)
+ run_locations(locations, original_results.failed_example_ids)
+ end
+
+ def command_for(locations)
+ parts = []
+
+ parts << RUBY << load_path
+ parts << open3_safe_escape(RSpec::Core.path_to_executable)
+
+ parts << "--format" << "bisect"
+ parts << "--drb-port" << @server.drb_port
+ parts.concat reusable_cli_options
+ parts.concat locations.map { |l| open3_safe_escape(l) }
+
+ parts.join(" ")
+ end
+
+ def repro_command_from(locations)
+ parts = []
+
+ parts << "rspec"
+ parts.concat Formatters::Helpers.organize_ids(locations)
+ parts.concat original_cli_args_without_locations
+
+ parts.join(" ")
+ end
+
+ def original_results
+ @original_results ||= run_locations(original_locations)
+ end
+
+ private
+
+ include RSpec::Core::ShellEscape
+ # On JRuby, Open3.popen3 does not handle shellescaped args properly:
+ # https://github.com/jruby/jruby/issues/2767
+ if RSpec::Support::Ruby.jruby?
+ # :nocov:
+ alias open3_safe_escape quote
+ # :nocov:
+ else
+ alias open3_safe_escape escape
+ end
+
+ def run_locations(locations, *capture_args)
+ @server.capture_run_results(*capture_args) do
+ run_command command_for(locations)
+ end
+ end
+
+ # `Open3.capture2e` does not work on JRuby:
+ # https://github.com/jruby/jruby/issues/2766
+ if Open3.respond_to?(:capture2e) && !RSpec::Support::Ruby.jruby?
+ def run_command(cmd)
+ Open3.capture2e(cmd).first
+ end
+ else # for 1.8.7
+ # :nocov:
+ def run_command(cmd)
+ out = err = nil
+
+ Open3.popen3(cmd) do |_, stdout, stderr|
+ # Reading the streams blocks until the process is complete
+ out = stdout.read
+ err = stderr.read
+ end
+
+ "Stdout:\n#{out}\n\nStderr:\n#{err}"
+ end
+ # :nocov:
+ end
+
+ def reusable_cli_options
+ @reusable_cli_options ||= begin
+ opts = original_cli_args_without_locations
+
+ if (port = parsed_original_cli_options[:drb_port])
+ opts -= %W[ --drb-port #{port} ]
+ end
+
+ parsed_original_cli_options.fetch(:formatters) { [] }.each do |(name, out)|
+ opts -= %W[ --format #{name} -f -f#{name} ]
+ opts -= %W[ --out #{out} -o -o#{out} ]
+ end
+
+ opts
+ end
+ end
+
+ def original_cli_args_without_locations
+ @original_cli_args_without_locations ||= begin
+ files_or_dirs = parsed_original_cli_options.fetch(:files_or_directories_to_run)
+ @original_cli_args - files_or_dirs
+ end
+ end
+
+ def parsed_original_cli_options
+ @parsed_original_cli_options ||= Parser.parse(@original_cli_args)
+ end
+
+ def original_locations
+ parsed_original_cli_options.fetch(:files_or_directories_to_run)
+ end
+
+ def load_path
+ @load_path ||= "-I#{$LOAD_PATH.map { |p| open3_safe_escape(p) }.join(':')}"
+ end
+
+ # Path to the currently running Ruby executable, borrowed from Rake:
+ # https://github.com/ruby/rake/blob/v10.4.2/lib/rake/file_utils.rb#L8-L12
+ # Note that we skip `ENV['RUBY']` because we don't have to deal with running
+ # RSpec from within a MRI source repository:
+ # https://github.com/ruby/rake/commit/968682759b3b65e42748cd2befb2ff3e982272d9
+ RUBY = File.join(
+ RbConfig::CONFIG['bindir'],
+ RbConfig::CONFIG['ruby_install_name'] + RbConfig::CONFIG['EXEEXT']).
+ sub(/.*\s.*/m, '"\&"')
+ end
+ end
+ end
+end
diff --git a/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/bisect/server.rb b/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/bisect/server.rb
new file mode 100644
index 0000000..35fe97d
--- /dev/null
+++ b/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/bisect/server.rb
@@ -0,0 +1,61 @@
+require 'drb/drb'
+require 'drb/acl'
+
+module RSpec
+ module Core
+ # @private
+ module Bisect
+ # @private
+ BisectFailedError = Class.new(StandardError)
+
+ # @private
+ # A DRb server that receives run results from a separate RSpec process
+ # started by the bisect process.
+ class Server
+ def self.run
+ server = new
+ server.start
+ yield server
+ ensure
+ server.stop
+ end
+
+ def capture_run_results(expected_failures=[])
+ self.expected_failures = expected_failures
+ self.latest_run_results = nil
+ run_output = yield
+ latest_run_results || raise_bisect_failed(run_output)
+ end
+
+ def start
+ # Only allow remote DRb requests from this machine.
+ DRb.install_acl ACL.new(%w[ deny all allow localhost allow 127.0.0.1 ])
+
+ # We pass `nil` as the first arg to allow it to pick a DRb port.
+ @drb = DRb.start_service(nil, self)
+ end
+
+ def stop
+ @drb.stop_service
+ end
+
+ def drb_port
+ @drb_port ||= Integer(@drb.uri[/\d+$/])
+ end
+
+ # Fetched via DRb by the BisectFormatter to determine when to abort.
+ attr_accessor :expected_failures
+
+ # Set via DRb by the BisectFormatter with the results of the run.
+ attr_accessor :latest_run_results
+
+ private
+
+ def raise_bisect_failed(run_output)
+ raise BisectFailedError, "Failed to get results from the spec " \
+ "run. Spec run output:\n\n#{run_output}"
+ end
+ end
+ end
+ end
+end
diff --git a/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/bisect/subset_enumerator.rb b/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/bisect/subset_enumerator.rb
new file mode 100644
index 0000000..7dc52cf
--- /dev/null
+++ b/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/bisect/subset_enumerator.rb
@@ -0,0 +1,39 @@
+module RSpec
+ module Core
+ module Bisect
+ # Enumerates each subset of the given list of ids that is half the
+ # size of the total list, so that hopefully we can discard half the
+ # list each repeatedly in order to our minimal repro case.
+ # @private
+ class SubsetEnumerator
+ include Enumerable
+
+ def initialize(ids)
+ @ids = ids
+ end
+
+ def subset_size
+ @subset_size ||= (@ids.size / 2.0).ceil
+ end
+
+ def each
+ yielded = Set.new
+ slice_size = subset_size
+ combo_count = 1
+
+ while slice_size > 0
+ @ids.each_slice(slice_size).to_a.combination(combo_count) do |combos|
+ subset = combos.flatten
+ next if yielded.include?(subset)
+ yield subset
+ yielded << subset
+ end
+
+ slice_size /= 2
+ combo_count *= 2
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/configuration.rb b/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/configuration.rb
new file mode 100644
index 0000000..2834d75
--- /dev/null
+++ b/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/configuration.rb
@@ -0,0 +1,1807 @@
+RSpec::Support.require_rspec_core "backtrace_formatter"
+RSpec::Support.require_rspec_core "ruby_project"
+RSpec::Support.require_rspec_core "formatters/deprecation_formatter"
+
+module RSpec
+ module Core
+ # rubocop:disable Style/ClassLength
+
+ # Stores runtime configuration information.
+ #
+ # Configuration options are loaded from `~/.rspec`, `.rspec`,
+ # `.rspec-local`, command line switches, and the `SPEC_OPTS` environment
+ # variable (listed in lowest to highest precedence; for example, an option
+ # in `~/.rspec` can be overridden by an option in `.rspec-local`).
+ #
+ # @example Standard settings
+ # RSpec.configure do |c|
+ # c.drb = true
+ # c.drb_port = 1234
+ # c.default_path = 'behavior'
+ # end
+ #
+ # @example Hooks
+ # RSpec.configure do |c|
+ # c.before(:suite) { establish_connection }
+ # c.before(:example) { log_in_as :authorized }
+ # c.around(:example) { |ex| Database.transaction(&ex) }
+ # end
+ #
+ # @see RSpec.configure
+ # @see Hooks
+ class Configuration
+ include RSpec::Core::Hooks
+
+ # Module that holds `attr_reader` declarations. It's in a separate
+ # module to allow us to override those methods and use `super`.
+ # @private
+ Readers = Module.new
+ include Readers
+
+ # @private
+ class MustBeConfiguredBeforeExampleGroupsError < StandardError; end
+
+ # @private
+ def self.define_reader(name)
+ Readers.class_eval do
+ remove_method name if method_defined?(name)
+ attr_reader name
+ end
+
+ define_method(name) { value_for(name) { super() } }
+ end
+
+ # @private
+ def self.define_aliases(name, alias_name)
+ alias_method alias_name, name
+ alias_method "#{alias_name}=", "#{name}="
+ define_predicate_for alias_name
+ end
+
+ # @private
+ def self.define_predicate_for(*names)
+ names.each { |name| alias_method "#{name}?", name }
+ end
+
+ # @private
+ #
+ # Invoked by the `add_setting` instance method. Use that method on a
+ # `Configuration` instance rather than this class method.
+ def self.add_setting(name, opts={})
+ raise "Use the instance add_setting method if you want to set a default" if opts.key?(:default)
+ attr_writer name
+ add_read_only_setting name
+
+ Array(opts[:alias_with]).each do |alias_name|
+ define_aliases(name, alias_name)
+ end
+ end
+
+ # @private
+ #
+ # As `add_setting` but only add the reader.
+ def self.add_read_only_setting(name, opts={})
+ raise "Use the instance add_setting method if you want to set a default" if opts.key?(:default)
+ define_reader name
+ define_predicate_for name
+ end
+
+ # @macro [attach] add_setting
+ # @!attribute [rw] $1
+ # @!method $1=(value)
+ #
+ # @macro [attach] define_reader
+ # @!attribute [r] $1
+
+ # @macro add_setting
+ # Path to use if no path is provided to the `rspec` command (default:
+ # `"spec"`). Allows you to just type `rspec` instead of `rspec spec` to
+ # run all the examples in the `spec` directory.
+ #
+ # @note Other scripts invoking `rspec` indirectly will ignore this
+ # setting.
+ add_setting :default_path
+
+ # @macro add_setting
+ # Run examples over DRb (default: `false`). RSpec doesn't supply the DRb
+ # server, but you can use tools like spork.
+ add_setting :drb
+
+ # @macro add_setting
+ # The drb_port (default: nil).
+ add_setting :drb_port
+
+ # @macro add_setting
+ # Default: `$stderr`.
+ add_setting :error_stream
+
+ # Indicates if the DSL has been exposed off of modules and `main`.
+ # Default: true
+ def expose_dsl_globally?
+ Core::DSL.exposed_globally?
+ end
+
+ # Use this to expose the core RSpec DSL via `Module` and the `main`
+ # object. It will be set automatically but you can override it to
+ # remove the DSL.
+ # Default: true
+ def expose_dsl_globally=(value)
+ if value
+ Core::DSL.expose_globally!
+ Core::SharedExampleGroup::TopLevelDSL.expose_globally!
+ else
+ Core::DSL.remove_globally!
+ Core::SharedExampleGroup::TopLevelDSL.remove_globally!
+ end
+ end
+
+ # Determines where deprecation warnings are printed.
+ # Defaults to `$stderr`.
+ # @return [IO, String] IO to write to or filename to write to
+ define_reader :deprecation_stream
+
+ # Determines where deprecation warnings are printed.
+ # @param value [IO, String] IO to write to or filename to write to
+ def deprecation_stream=(value)
+ if @reporter && !value.equal?(@deprecation_stream)
+ warn "RSpec's reporter has already been initialized with " \
+ "#{deprecation_stream.inspect} as the deprecation stream, so your change to "\
+ "`deprecation_stream` will be ignored. You should configure it earlier for " \
+ "it to take effect, or use the `--deprecation-out` CLI option. " \
+ "(Called from #{CallerFilter.first_non_rspec_line})"
+ else
+ @deprecation_stream = value
+ end
+ end
+
+ # @macro define_reader
+ # The file path to use for persisting example statuses. Necessary for the
+ # `--only-failures` and `--next-failures` CLI options.
+ #
+ # @overload example_status_persistence_file_path
+ # @return [String] the file path
+ # @overload example_status_persistence_file_path=(value)
+ # @param value [String] the file path
+ define_reader :example_status_persistence_file_path
+
+ # Sets the file path to use for persisting example statuses. Necessary for the
+ # `--only-failures` and `--next-failures` CLI options.
+ def example_status_persistence_file_path=(value)
+ @example_status_persistence_file_path = value
+ clear_values_derived_from_example_status_persistence_file_path
+ end
+
+ # @macro define_reader
+ # Indicates if the `--only-failures` (or `--next-failure`) flag is being used.
+ define_reader :only_failures
+ alias_method :only_failures?, :only_failures
+
+ # @private
+ def only_failures_but_not_configured?
+ only_failures? && !example_status_persistence_file_path
+ end
+
+ # @macro add_setting
+ # Clean up and exit after the first failure (default: `false`).
+ add_setting :fail_fast
+
+ # @macro add_setting
+ # Prints the formatter output of your suite without running any
+ # examples or hooks.
+ add_setting :dry_run
+
+ # @macro add_setting
+ # The exit code to return if there are any failures (default: 1).
+ add_setting :failure_exit_code
+
+ # @macro define_reader
+ # Indicates files configured to be required.
+ define_reader :requires
+
+ # @macro define_reader
+ # Returns dirs that have been prepended to the load path by the `-I`
+ # command line option.
+ define_reader :libs
+
+ # @macro add_setting
+ # Determines where RSpec will send its output.
+ # Default: `$stdout`.
+ define_reader :output_stream
+
+ # Set the output stream for reporter.
+ # @attr value [IO] value for output, defaults to $stdout
+ def output_stream=(value)
+ if @reporter && !value.equal?(@output_stream)
+ warn "RSpec's reporter has already been initialized with " \
+ "#{output_stream.inspect} as the output stream, so your change to "\
+ "`output_stream` will be ignored. You should configure it earlier for " \
+ "it to take effect. (Called from #{CallerFilter.first_non_rspec_line})"
+ else
+ @output_stream = value
+ end
+ end
+
+ # @macro define_reader
+ # Load files matching this pattern (default: `'**{,/*/**}/*_spec.rb'`).
+ define_reader :pattern
+
+ # Set pattern to match files to load.
+ # @attr value [String] the filename pattern to filter spec files by
+ def pattern=(value)
+ update_pattern_attr :pattern, value
+ end
+
+ # @macro define_reader
+ # Exclude files matching this pattern.
+ define_reader :exclude_pattern
+
+ # Set pattern to match files to exclude.
+ # @attr value [String] the filename pattern to exclude spec files by
+ def exclude_pattern=(value)
+ update_pattern_attr :exclude_pattern, value
+ end
+
+ # @macro add_setting
+ # Report the times for the slowest examples (default: `false`).
+ # Use this to specify the number of examples to include in the profile.
+ add_setting :profile_examples
+
+ # @macro add_setting
+ # Run all examples if none match the configured filters
+ # (default: `false`).
+ add_setting :run_all_when_everything_filtered
+
+ # @macro add_setting
+ # Color to use to indicate success.
+ # @param color [Symbol] defaults to `:green` but can be set to one of the
+ # following: `[:black, :white, :red, :green, :yellow, :blue, :magenta,
+ # :cyan]`
+ add_setting :success_color
+
+ # @macro add_setting
+ # Color to use to print pending examples.
+ # @param color [Symbol] defaults to `:yellow` but can be set to one of the
+ # following: `[:black, :white, :red, :green, :yellow, :blue, :magenta,
+ # :cyan]`
+ add_setting :pending_color
+
+ # @macro add_setting
+ # Color to use to indicate failure.
+ # @param color [Symbol] defaults to `:red` but can be set to one of the
+ # following: `[:black, :white, :red, :green, :yellow, :blue, :magenta,
+ # :cyan]`
+ add_setting :failure_color
+
+ # @macro add_setting
+ # The default output color.
+ # @param color [Symbol] defaults to `:white` but can be set to one of the
+ # following: `[:black, :white, :red, :green, :yellow, :blue, :magenta,
+ # :cyan]`
+ add_setting :default_color
+
+ # @macro add_setting
+ # Color used when a pending example is fixed.
+ # @param color [Symbol] defaults to `:blue` but can be set to one of the
+ # following: `[:black, :white, :red, :green, :yellow, :blue, :magenta,
+ # :cyan]`
+ add_setting :fixed_color
+
+ # @macro add_setting
+ # Color used to print details.
+ # @param color [Symbol] defaults to `:cyan` but can be set to one of the
+ # following: `[:black, :white, :red, :green, :yellow, :blue, :magenta,
+ # :cyan]`
+ add_setting :detail_color
+
+ # Deprecated. This config option was added in RSpec 2 to pave the way
+ # for this being the default behavior in RSpec 3. Now this option is
+ # a no-op.
+ def treat_symbols_as_metadata_keys_with_true_values=(_value)
+ RSpec.deprecate(
+ "RSpec::Core::Configuration#treat_symbols_as_metadata_keys_with_true_values=",
+ :message => "RSpec::Core::Configuration#treat_symbols_as_metadata_keys_with_true_values= " \
+ "is deprecated, it is now set to true as default and " \
+ "setting it to false has no effect."
+ )
+ end
+
+ # Record the start time of the spec suite to measure load time.
+ add_setting :start_time
+
+ # @macro add_setting
+ # Use threadsafe options where available.
+ # Currently this will place a mutex around memoized values such as let blocks.
+ add_setting :threadsafe
+
+ # @private
+ add_setting :tty
+ # @private
+ attr_writer :files_to_run
+ # @private
+ attr_accessor :filter_manager
+ # @private
+ attr_accessor :static_config_filter_manager
+ # @private
+ attr_reader :backtrace_formatter, :ordering_manager, :loaded_spec_files
+
+ def initialize
+ # rubocop:disable Style/GlobalVars
+ @start_time = $_rspec_core_load_started_at || ::RSpec::Core::Time.now
+ # rubocop:enable Style/GlobalVars
+ @expectation_frameworks = []
+ @include_modules = FilterableItemRepository::QueryOptimized.new(:any?)
+ @extend_modules = FilterableItemRepository::QueryOptimized.new(:any?)
+ @prepend_modules = FilterableItemRepository::QueryOptimized.new(:any?)
+
+ @before_suite_hooks = []
+ @after_suite_hooks = []
+
+ @mock_framework = nil
+ @files_or_directories_to_run = []
+ @loaded_spec_files = Set.new
+ @color = false
+ @pattern = '**{,/*/**}/*_spec.rb'
+ @exclude_pattern = ''
+ @failure_exit_code = 1
+ @spec_files_loaded = false
+
+ @backtrace_formatter = BacktraceFormatter.new
+
+ @default_path = 'spec'
+ @deprecation_stream = $stderr
+ @output_stream = $stdout
+ @reporter = nil
+ @reporter_buffer = nil
+ @filter_manager = FilterManager.new
+ @static_config_filter_manager = FilterManager.new
+ @ordering_manager = Ordering::ConfigurationManager.new
+ @preferred_options = {}
+ @failure_color = :red
+ @success_color = :green
+ @pending_color = :yellow
+ @default_color = :white
+ @fixed_color = :blue
+ @detail_color = :cyan
+ @profile_examples = false
+ @requires = []
+ @libs = []
+ @derived_metadata_blocks = FilterableItemRepository::QueryOptimized.new(:any?)
+ @threadsafe = true
+
+ define_built_in_hooks
+ end
+
+ # @private
+ #
+ # Used to set higher priority option values from the command line.
+ def force(hash)
+ ordering_manager.force(hash)
+ @preferred_options.merge!(hash)
+
+ return unless hash.key?(:example_status_persistence_file_path)
+ clear_values_derived_from_example_status_persistence_file_path
+ end
+
+ # @private
+ def reset
+ @spec_files_loaded = false
+ @reporter = nil
+ @formatter_loader = nil
+ end
+
+ # @private
+ def reset_filters
+ self.filter_manager = FilterManager.new
+ filter_manager.include_only(
+ Metadata.deep_hash_dup(static_config_filter_manager.inclusions.rules)
+ )
+ filter_manager.exclude_only(
+ Metadata.deep_hash_dup(static_config_filter_manager.exclusions.rules)
+ )
+ end
+
+ # @overload add_setting(name)
+ # @overload add_setting(name, opts)
+ # @option opts [Symbol] :default
+ #
+ # Set a default value for the generated getter and predicate methods:
+ #
+ # add_setting(:foo, :default => "default value")
+ #
+ # @option opts [Symbol] :alias_with
+ #
+ # Use `:alias_with` to alias the setter, getter, and predicate to
+ # another name, or names:
+ #
+ # add_setting(:foo, :alias_with => :bar)
+ # add_setting(:foo, :alias_with => [:bar, :baz])
+ #
+ # Adds a custom setting to the RSpec.configuration object.
+ #
+ # RSpec.configuration.add_setting :foo
+ #
+ # Used internally and by extension frameworks like rspec-rails, so they
+ # can add config settings that are domain specific. For example:
+ #
+ # RSpec.configure do |c|
+ # c.add_setting :use_transactional_fixtures,
+ # :default => true,
+ # :alias_with => :use_transactional_examples
+ # end
+ #
+ # `add_setting` creates three methods on the configuration object, a
+ # setter, a getter, and a predicate:
+ #
+ # RSpec.configuration.foo=(value)
+ # RSpec.configuration.foo
+ # RSpec.configuration.foo? # Returns true if foo returns anything but nil or false.
+ def add_setting(name, opts={})
+ default = opts.delete(:default)
+ (class << self; self; end).class_exec do
+ add_setting(name, opts)
+ end
+ __send__("#{name}=", default) if default
+ end
+
+ # Returns the configured mock framework adapter module.
+ def mock_framework
+ if @mock_framework.nil?
+ begin
+ mock_with :rspec
+ rescue LoadError
+ mock_with :nothing
+ end
+ end
+ @mock_framework
+ end
+
+ # Delegates to mock_framework=(framework).
+ def mock_framework=(framework)
+ mock_with framework
+ end
+
+ # Regexps used to exclude lines from backtraces.
+ #
+ # Excludes lines from ruby (and jruby) source, installed gems, anything
+ # in any "bin" directory, and any of the RSpec libs (outside gem
+ # installs) by default.
+ #
+ # You can modify the list via the getter, or replace it with the setter.
+ #
+ # To override this behaviour and display a full backtrace, use
+ # `--backtrace` on the command line, in a `.rspec` file, or in the
+ # `rspec_options` attribute of RSpec's rake task.
+ def backtrace_exclusion_patterns
+ @backtrace_formatter.exclusion_patterns
+ end
+
+ # Set regular expressions used to exclude lines in backtrace.
+ # @param patterns [Regexp] set the backtrace exlusion pattern
+ def backtrace_exclusion_patterns=(patterns)
+ @backtrace_formatter.exclusion_patterns = patterns
+ end
+
+ # Regexps used to include lines in backtraces.
+ #
+ # Defaults to [Regexp.new Dir.getwd].
+ #
+ # Lines that match an exclusion _and_ an inclusion pattern
+ # will be included.
+ #
+ # You can modify the list via the getter, or replace it with the setter.
+ def backtrace_inclusion_patterns
+ @backtrace_formatter.inclusion_patterns
+ end
+
+ # Set regular expressions used to include lines in backtrace.
+ # @attr patterns [Regexp] set backtrace_formatter inclusion_patterns
+ def backtrace_inclusion_patterns=(patterns)
+ @backtrace_formatter.inclusion_patterns = patterns
+ end
+
+ # Adds {#backtrace_exclusion_patterns} that will filter lines from
+ # the named gems from backtraces.
+ #
+ # @param gem_names [Array] Names of the gems to filter
+ #
+ # @example
+ # RSpec.configure do |config|
+ # config.filter_gems_from_backtrace "rack", "rake"
+ # end
+ #
+ # @note The patterns this adds will match the named gems in their common
+ # locations (e.g. system gems, vendored with bundler, installed as a
+ # :git dependency with bundler, etc) but is not guaranteed to work for
+ # all possible gem locations. For example, if you have the gem source
+ # in a directory with a completely unrelated name, and use bundler's
+ # :path option, this will not filter it.
+ def filter_gems_from_backtrace(*gem_names)
+ gem_names.each do |name|
+ @backtrace_formatter.filter_gem(name)
+ end
+ end
+
+ # @private
+ MOCKING_ADAPTERS = {
+ :rspec => :RSpec,
+ :flexmock => :Flexmock,
+ :rr => :RR,
+ :mocha => :Mocha,
+ :nothing => :Null
+ }
+
+ # Sets the mock framework adapter module.
+ #
+ # `framework` can be a Symbol or a Module.
+ #
+ # Given any of `:rspec`, `:mocha`, `:flexmock`, or `:rr`, configures the
+ # named framework.
+ #
+ # Given `:nothing`, configures no framework. Use this if you don't use
+ # any mocking framework to save a little bit of overhead.
+ #
+ # Given a Module, includes that module in every example group. The module
+ # should adhere to RSpec's mock framework adapter API:
+ #
+ # setup_mocks_for_rspec
+ # - called before each example
+ #
+ # verify_mocks_for_rspec
+ # - called after each example if the example hasn't yet failed.
+ # Framework should raise an exception when expectations fail
+ #
+ # teardown_mocks_for_rspec
+ # - called after verify_mocks_for_rspec (even if there are errors)
+ #
+ # If the module responds to `configuration` and `mock_with` receives a
+ # block, it will yield the configuration object to the block e.g.
+ #
+ # config.mock_with OtherMockFrameworkAdapter do |mod_config|
+ # mod_config.custom_setting = true
+ # end
+ def mock_with(framework)
+ framework_module =
+ if framework.is_a?(Module)
+ framework
+ else
+ const_name = MOCKING_ADAPTERS.fetch(framework) do
+ raise ArgumentError,
+ "Unknown mocking framework: #{framework.inspect}. " \
+ "Pass a module or one of #{MOCKING_ADAPTERS.keys.inspect}"
+ end
+
+ RSpec::Support.require_rspec_core "mocking_adapters/#{const_name.to_s.downcase}"
+ RSpec::Core::MockingAdapters.const_get(const_name)
+ end
+
+ new_name, old_name = [framework_module, @mock_framework].map do |mod|
+ mod.respond_to?(:framework_name) ? mod.framework_name : :unnamed
+ end
+
+ unless new_name == old_name
+ assert_no_example_groups_defined(:mock_framework)
+ end
+
+ if block_given?
+ raise "#{framework_module} must respond to `configuration` so that " \
+ "mock_with can yield it." unless framework_module.respond_to?(:configuration)
+ yield framework_module.configuration
+ end
+
+ @mock_framework = framework_module
+ end
+
+ # Returns the configured expectation framework adapter module(s)
+ def expectation_frameworks
+ if @expectation_frameworks.empty?
+ begin
+ expect_with :rspec
+ rescue LoadError
+ expect_with Module.new
+ end
+ end
+ @expectation_frameworks
+ end
+
+ # Delegates to expect_with(framework).
+ def expectation_framework=(framework)
+ expect_with(framework)
+ end
+
+ # Sets the expectation framework module(s) to be included in each example
+ # group.
+ #
+ # `frameworks` can be `:rspec`, `:test_unit`, `:minitest`, a custom
+ # module, or any combination thereof:
+ #
+ # config.expect_with :rspec
+ # config.expect_with :test_unit
+ # config.expect_with :minitest
+ # config.expect_with :rspec, :minitest
+ # config.expect_with OtherExpectationFramework
+ #
+ # RSpec will translate `:rspec`, `:minitest`, and `:test_unit` into the
+ # appropriate modules.
+ #
+ # ## Configuration
+ #
+ # If the module responds to `configuration`, `expect_with` will
+ # yield the `configuration` object if given a block:
+ #
+ # config.expect_with OtherExpectationFramework do |custom_config|
+ # custom_config.custom_setting = true
+ # end
+ def expect_with(*frameworks)
+ modules = frameworks.map do |framework|
+ case framework
+ when Module
+ framework
+ when :rspec
+ require 'rspec/expectations'
+
+ # Tag this exception class so our exception formatting logic knows
+ # that it satisfies the `MultipleExceptionError` interface.
+ ::RSpec::Expectations::MultipleExpectationsNotMetError.__send__(
+ :include, MultipleExceptionError::InterfaceTag
+ )
+
+ ::RSpec::Matchers
+ when :test_unit
+ require 'rspec/core/test_unit_assertions_adapter'
+ ::RSpec::Core::TestUnitAssertionsAdapter
+ when :minitest
+ require 'rspec/core/minitest_assertions_adapter'
+ ::RSpec::Core::MinitestAssertionsAdapter
+ else
+ raise ArgumentError, "#{framework.inspect} is not supported"
+ end
+ end
+
+ if (modules - @expectation_frameworks).any?
+ assert_no_example_groups_defined(:expect_with)
+ end
+
+ if block_given?
+ raise "expect_with only accepts a block with a single argument. " \
+ "Call expect_with #{modules.length} times, " \
+ "once with each argument, instead." if modules.length > 1
+ raise "#{modules.first} must respond to `configuration` so that " \
+ "expect_with can yield it." unless modules.first.respond_to?(:configuration)
+ yield modules.first.configuration
+ end
+
+ @expectation_frameworks.push(*modules)
+ end
+
+ # Check if full backtrace is enabled.
+ # @return [Boolean] is full backtrace enabled
+ def full_backtrace?
+ @backtrace_formatter.full_backtrace?
+ end
+
+ # Toggle full backtrace.
+ # @attr true_or_false [Boolean] toggle full backtrace display
+ def full_backtrace=(true_or_false)
+ @backtrace_formatter.full_backtrace = true_or_false
+ end
+
+ # Returns the configuration option for color, but should not
+ # be used to check if color is supported.
+ #
+ # @see color_enabled?
+ # @return [Boolean]
+ def color
+ value_for(:color) { @color }
+ end
+
+ # Check if color is enabled for a particular output.
+ # @param output [IO] an output stream to use, defaults to the current
+ # `output_stream`
+ # @return [Boolean]
+ def color_enabled?(output=output_stream)
+ output_to_tty?(output) && color
+ end
+
+ # Toggle output color.
+ # @attr true_or_false [Boolean] toggle color enabled
+ def color=(true_or_false)
+ return unless true_or_false
+
+ if RSpec::Support::OS.windows? && !ENV['ANSICON']
+ RSpec.warning "You must use ANSICON 1.31 or later " \
+ "(http://adoxa.3eeweb.com/ansicon/) to use colour " \
+ "on Windows"
+ @color = false
+ else
+ @color = true
+ end
+ end
+
+ # @private
+ def libs=(libs)
+ libs.map do |lib|
+ @libs.unshift lib
+ $LOAD_PATH.unshift lib
+ end
+ end
+
+ # Run examples matching on `description` in all files to run.
+ # @param description [String, Regexp] the pattern to filter on
+ def full_description=(description)
+ filter_run :full_description => Regexp.union(*Array(description).map { |d| Regexp.new(d) })
+ end
+
+ # @return [Array] full description filter
+ def full_description
+ filter.fetch :full_description, nil
+ end
+
+ # @overload add_formatter(formatter)
+ #
+ # Adds a formatter to the formatters collection. `formatter` can be a
+ # string representing any of the built-in formatters (see
+ # `built_in_formatter`), or a custom formatter class.
+ #
+ # ### Note
+ #
+ # For internal purposes, `add_formatter` also accepts the name of a class
+ # and paths to use for output streams, but you should consider that a
+ # private api that may change at any time without notice.
+ def add_formatter(formatter_to_use, *paths)
+ paths << output_stream if paths.empty?
+ formatter_loader.add formatter_to_use, *paths
+ end
+ alias_method :formatter=, :add_formatter
+
+ # The formatter that will be used if no formatter has been set.
+ # Defaults to 'progress'.
+ def default_formatter
+ formatter_loader.default_formatter
+ end
+
+ # Sets a fallback formatter to use if none other has been set.
+ #
+ # @example
+ #
+ # RSpec.configure do |rspec|
+ # rspec.default_formatter = 'doc'
+ # end
+ def default_formatter=(value)
+ formatter_loader.default_formatter = value
+ end
+
+ # Returns a duplicate of the formatters currently loaded in
+ # the `FormatterLoader` for introspection.
+ #
+ # Note as this is a duplicate, any mutations will be disregarded.
+ #
+ # @return [Array] the formatters currently loaded
+ def formatters
+ formatter_loader.formatters.dup
+ end
+
+ # @private
+ def formatter_loader
+ @formatter_loader ||= Formatters::Loader.new(Reporter.new(self))
+ end
+
+ # @private
+ #
+ # This buffer is used to capture all messages sent to the reporter during
+ # reporter initialization. It can then replay those messages after the
+ # formatter is correctly initialized. Otherwise, deprecation warnings
+ # during formatter initialization can cause an infinite loop.
+ class DeprecationReporterBuffer
+ def initialize
+ @calls = []
+ end
+
+ def deprecation(*args)
+ @calls << args
+ end
+
+ def play_onto(reporter)
+ @calls.each do |args|
+ reporter.deprecation(*args)
+ end
+ end
+ end
+
+ # @private
+ def reporter
+ # @reporter_buffer should only ever be set in this method to cover
+ # initialization of @reporter.
+ @reporter_buffer || @reporter ||=
+ begin
+ @reporter_buffer = DeprecationReporterBuffer.new
+ formatter_loader.setup_default output_stream, deprecation_stream
+ @reporter_buffer.play_onto(formatter_loader.reporter)
+ @reporter_buffer = nil
+ formatter_loader.reporter
+ end
+ end
+
+ # @api private
+ #
+ # Defaults `profile_examples` to 10 examples when `@profile_examples` is
+ # `true`.
+ def profile_examples
+ profile = value_for(:profile_examples) { @profile_examples }
+ if profile && !profile.is_a?(Integer)
+ 10
+ else
+ profile
+ end
+ end
+
+ # @private
+ def files_or_directories_to_run=(*files)
+ files = files.flatten
+
+ if (command == 'rspec' || Runner.running_in_drb?) && default_path && files.empty?
+ files << default_path
+ end
+
+ @files_or_directories_to_run = files
+ @files_to_run = nil
+ end
+
+ # The spec files RSpec will run.
+ # @return [Array] specified files about to run
+ def files_to_run
+ @files_to_run ||= get_files_to_run(@files_or_directories_to_run)
+ end
+
+ # @private
+ def last_run_statuses
+ @last_run_statuses ||= Hash.new(UNKNOWN_STATUS).tap do |statuses|
+ if (path = example_status_persistence_file_path)
+ begin
+ ExampleStatusPersister.load_from(path).inject(statuses) do |hash, example|
+ hash[example.fetch(:example_id)] = example.fetch(:status)
+ hash
+ end
+ rescue SystemCallError => e
+ RSpec.warning "Could not read from #{path.inspect} (configured as " \
+ "`config.example_status_persistence_file_path`) due " \
+ "to a system error: #{e.inspect}. Please check that " \
+ "the config option is set to an accessible, valid " \
+ "file path", :call_site => nil
+ end
+ end
+ end
+ end
+
+ # @private
+ UNKNOWN_STATUS = "unknown".freeze
+
+ # @private
+ FAILED_STATUS = "failed".freeze
+
+ # @private
+ def spec_files_with_failures
+ @spec_files_with_failures ||= last_run_statuses.inject(Set.new) do |files, (id, status)|
+ files << id.split(ON_SQUARE_BRACKETS).first if status == FAILED_STATUS
+ files
+ end.to_a
+ end
+
+ # Creates a method that delegates to `example` including the submitted
+ # `args`. Used internally to add variants of `example` like `pending`:
+ # @param name [String] example name alias
+ # @param args [Array, Hash] metadata for the generated example
+ #
+ # @note The specific example alias below (`pending`) is already
+ # defined for you.
+ # @note Use with caution. This extends the language used in your
+ # specs, but does not add any additional documentation. We use this
+ # in RSpec to define methods like `focus` and `xit`, but we also add
+ # docs for those methods.
+ #
+ # @example
+ # RSpec.configure do |config|
+ # config.alias_example_to :pending, :pending => true
+ # end
+ #
+ # # This lets you do this:
+ #
+ # describe Thing do
+ # pending "does something" do
+ # thing = Thing.new
+ # end
+ # end
+ #
+ # # ... which is the equivalent of
+ #
+ # describe Thing do
+ # it "does something", :pending => true do
+ # thing = Thing.new
+ # end
+ # end
+ def alias_example_to(name, *args)
+ extra_options = Metadata.build_hash_from(args)
+ RSpec::Core::ExampleGroup.define_example_method(name, extra_options)
+ end
+
+ # Creates a method that defines an example group with the provided
+ # metadata. Can be used to define example group/metadata shortcuts.
+ #
+ # @example
+ # RSpec.configure do |config|
+ # config.alias_example_group_to :describe_model, :type => :model
+ # end
+ #
+ # shared_context_for "model tests", :type => :model do
+ # # define common model test helper methods, `let` declarations, etc
+ # end
+ #
+ # # This lets you do this:
+ #
+ # RSpec.describe_model User do
+ # end
+ #
+ # # ... which is the equivalent of
+ #
+ # RSpec.describe User, :type => :model do
+ # end
+ #
+ # @note The defined aliased will also be added to the top level
+ # (e.g. `main` and from within modules) if
+ # `expose_dsl_globally` is set to true.
+ # @see #alias_example_to
+ # @see #expose_dsl_globally=
+ def alias_example_group_to(new_name, *args)
+ extra_options = Metadata.build_hash_from(args)
+ RSpec::Core::ExampleGroup.define_example_group_method(new_name, extra_options)
+ end
+
+ # Define an alias for it_should_behave_like that allows different
+ # language (like "it_has_behavior" or "it_behaves_like") to be
+ # employed when including shared examples.
+ #
+ # @example
+ # RSpec.configure do |config|
+ # config.alias_it_behaves_like_to(:it_has_behavior, 'has behavior:')
+ # end
+ #
+ # # allows the user to include a shared example group like:
+ #
+ # describe Entity do
+ # it_has_behavior 'sortability' do
+ # let(:sortable) { Entity.new }
+ # end
+ # end
+ #
+ # # which is reported in the output as:
+ # # Entity
+ # # has behavior: sortability
+ # # ...sortability examples here
+ #
+ # @note Use with caution. This extends the language used in your
+ # specs, but does not add any additional documentation. We use this
+ # in RSpec to define `it_should_behave_like` (for backward
+ # compatibility), but we also add docs for that method.
+ def alias_it_behaves_like_to(new_name, report_label='')
+ RSpec::Core::ExampleGroup.define_nested_shared_group_method(new_name, report_label)
+ end
+ alias_method :alias_it_should_behave_like_to, :alias_it_behaves_like_to
+
+ # Adds key/value pairs to the `inclusion_filter`. If `args`
+ # includes any symbols that are not part of the hash, each symbol
+ # is treated as a key in the hash with the value `true`.
+ #
+ # ### Note
+ #
+ # Filters set using this method can be overridden from the command line
+ # or config files (e.g. `.rspec`).
+ #
+ # @example
+ # # Given this declaration.
+ # describe "something", :foo => 'bar' do
+ # # ...
+ # end
+ #
+ # # Any of the following will include that group.
+ # config.filter_run_including :foo => 'bar'
+ # config.filter_run_including :foo => /^ba/
+ # config.filter_run_including :foo => lambda {|v| v == 'bar'}
+ # config.filter_run_including :foo => lambda {|v,m| m[:foo] == 'bar'}
+ #
+ # # Given a proc with an arity of 1, the lambda is passed the value
+ # # related to the key, e.g.
+ # config.filter_run_including :foo => lambda {|v| v == 'bar'}
+ #
+ # # Given a proc with an arity of 2, the lambda is passed the value
+ # # related to the key, and the metadata itself e.g.
+ # config.filter_run_including :foo => lambda {|v,m| m[:foo] == 'bar'}
+ #
+ # filter_run_including :foo # same as filter_run_including :foo => true
+ def filter_run_including(*args)
+ meta = Metadata.build_hash_from(args, :warn_about_example_group_filtering)
+ filter_manager.include_with_low_priority meta
+ static_config_filter_manager.include_with_low_priority Metadata.deep_hash_dup(meta)
+ end
+
+ alias_method :filter_run, :filter_run_including
+
+ # Clears and reassigns the `inclusion_filter`. Set to `nil` if you don't
+ # want any inclusion filter at all.
+ #
+ # ### Warning
+ #
+ # This overrides any inclusion filters/tags set on the command line or in
+ # configuration files.
+ def inclusion_filter=(filter)
+ meta = Metadata.build_hash_from([filter], :warn_about_example_group_filtering)
+ filter_manager.include_only meta
+ end
+
+ alias_method :filter=, :inclusion_filter=
+
+ # Returns the `inclusion_filter`. If none has been set, returns an empty
+ # hash.
+ def inclusion_filter
+ filter_manager.inclusions
+ end
+
+ alias_method :filter, :inclusion_filter
+
+ # Adds key/value pairs to the `exclusion_filter`. If `args`
+ # includes any symbols that are not part of the hash, each symbol
+ # is treated as a key in the hash with the value `true`.
+ #
+ # ### Note
+ #
+ # Filters set using this method can be overridden from the command line
+ # or config files (e.g. `.rspec`).
+ #
+ # @example
+ # # Given this declaration.
+ # describe "something", :foo => 'bar' do
+ # # ...
+ # end
+ #
+ # # Any of the following will exclude that group.
+ # config.filter_run_excluding :foo => 'bar'
+ # config.filter_run_excluding :foo => /^ba/
+ # config.filter_run_excluding :foo => lambda {|v| v == 'bar'}
+ # config.filter_run_excluding :foo => lambda {|v,m| m[:foo] == 'bar'}
+ #
+ # # Given a proc with an arity of 1, the lambda is passed the value
+ # # related to the key, e.g.
+ # config.filter_run_excluding :foo => lambda {|v| v == 'bar'}
+ #
+ # # Given a proc with an arity of 2, the lambda is passed the value
+ # # related to the key, and the metadata itself e.g.
+ # config.filter_run_excluding :foo => lambda {|v,m| m[:foo] == 'bar'}
+ #
+ # filter_run_excluding :foo # same as filter_run_excluding :foo => true
+ def filter_run_excluding(*args)
+ meta = Metadata.build_hash_from(args, :warn_about_example_group_filtering)
+ filter_manager.exclude_with_low_priority meta
+ static_config_filter_manager.exclude_with_low_priority Metadata.deep_hash_dup(meta)
+ end
+
+ # Clears and reassigns the `exclusion_filter`. Set to `nil` if you don't
+ # want any exclusion filter at all.
+ #
+ # ### Warning
+ #
+ # This overrides any exclusion filters/tags set on the command line or in
+ # configuration files.
+ def exclusion_filter=(filter)
+ meta = Metadata.build_hash_from([filter], :warn_about_example_group_filtering)
+ filter_manager.exclude_only meta
+ end
+
+ # Returns the `exclusion_filter`. If none has been set, returns an empty
+ # hash.
+ def exclusion_filter
+ filter_manager.exclusions
+ end
+
+ # Tells RSpec to include `mod` in example groups. Methods defined in
+ # `mod` are exposed to examples (not example groups). Use `filters` to
+ # constrain the groups or examples in which to include the module.
+ #
+ # @example
+ #
+ # module AuthenticationHelpers
+ # def login_as(user)
+ # # ...
+ # end
+ # end
+ #
+ # module UserHelpers
+ # def users(username)
+ # # ...
+ # end
+ # end
+ #
+ # RSpec.configure do |config|
+ # config.include(UserHelpers) # included in all modules
+ # config.include(AuthenticationHelpers, :type => :request)
+ # end
+ #
+ # describe "edit profile", :type => :request do
+ # it "can be viewed by owning user" do
+ # login_as users(:jdoe)
+ # get "/profiles/jdoe"
+ # assert_select ".username", :text => 'jdoe'
+ # end
+ # end
+ #
+ # @note Filtered module inclusions can also be applied to
+ # individual examples that have matching metadata. Just like
+ # Ruby's object model is that every object has a singleton class
+ # which has only a single instance, RSpec's model is that every
+ # example has a singleton example group containing just the one
+ # example.
+ #
+ # @see #extend
+ # @see #prepend
+ def include(mod, *filters)
+ meta = Metadata.build_hash_from(filters, :warn_about_example_group_filtering)
+ @include_modules.append(mod, meta)
+ configure_existing_groups(mod, meta, :safe_include)
+ end
+
+ # Tells RSpec to extend example groups with `mod`. Methods defined in
+ # `mod` are exposed to example groups (not examples). Use `filters` to
+ # constrain the groups to extend.
+ #
+ # Similar to `include`, but behavior is added to example groups, which
+ # are classes, rather than the examples, which are instances of those
+ # classes.
+ #
+ # @example
+ #
+ # module UiHelpers
+ # def run_in_browser
+ # # ...
+ # end
+ # end
+ #
+ # RSpec.configure do |config|
+ # config.extend(UiHelpers, :type => :request)
+ # end
+ #
+ # describe "edit profile", :type => :request do
+ # run_in_browser
+ #
+ # it "does stuff in the client" do
+ # # ...
+ # end
+ # end
+ #
+ # @see #include
+ # @see #prepend
+ def extend(mod, *filters)
+ meta = Metadata.build_hash_from(filters, :warn_about_example_group_filtering)
+ @extend_modules.append(mod, meta)
+ configure_existing_groups(mod, meta, :safe_extend)
+ end
+
+ if RSpec::Support::RubyFeatures.module_prepends_supported?
+ # Tells RSpec to prepend example groups with `mod`. Methods defined in
+ # `mod` are exposed to examples (not example groups). Use `filters` to
+ # constrain the groups in which to prepend the module.
+ #
+ # Similar to `include`, but module is included before the example group's class
+ # in the ancestor chain.
+ #
+ # @example
+ #
+ # module OverrideMod
+ # def override_me
+ # "overridden"
+ # end
+ # end
+ #
+ # RSpec.configure do |config|
+ # config.prepend(OverrideMod, :method => :prepend)
+ # end
+ #
+ # describe "overriding example's class", :method => :prepend do
+ # it "finds the user" do
+ # self.class.class_eval do
+ # def override_me
+ # end
+ # end
+ # override_me # => "overridden"
+ # # ...
+ # end
+ # end
+ #
+ # @see #include
+ # @see #extend
+ def prepend(mod, *filters)
+ meta = Metadata.build_hash_from(filters, :warn_about_example_group_filtering)
+ @prepend_modules.append(mod, meta)
+ configure_existing_groups(mod, meta, :safe_prepend)
+ end
+ end
+
+ # @private
+ #
+ # Used internally to extend a group with modules using `include`, `prepend` and/or
+ # `extend`.
+ def configure_group(group)
+ configure_group_with group, @include_modules, :safe_include
+ configure_group_with group, @extend_modules, :safe_extend
+ configure_group_with group, @prepend_modules, :safe_prepend
+ end
+
+ # @private
+ def configure_group_with(group, module_list, application_method)
+ module_list.items_for(group.metadata).each do |mod|
+ __send__(application_method, mod, group)
+ end
+ end
+
+ # @private
+ def configure_existing_groups(mod, meta, application_method)
+ RSpec.world.all_example_groups.each do |group|
+ next unless meta.empty? || MetadataFilter.apply?(:any?, meta, group.metadata)
+ __send__(application_method, mod, group)
+ end
+ end
+
+ # @private
+ #
+ # Used internally to extend the singleton class of a single example's
+ # example group instance with modules using `include` and/or `extend`.
+ def configure_example(example)
+ singleton_group = example.example_group_instance.singleton_class
+
+ # We replace the metadata so that SharedExampleGroupModule#included
+ # has access to the example's metadata[:location].
+ singleton_group.with_replaced_metadata(example.metadata) do
+ modules = @include_modules.items_for(example.metadata)
+ modules.each do |mod|
+ safe_include(mod, example.example_group_instance.singleton_class)
+ end
+
+ MemoizedHelpers.define_helpers_on(singleton_group) unless modules.empty?
+ end
+ end
+
+ if RSpec::Support::RubyFeatures.module_prepends_supported?
+ # @private
+ def safe_prepend(mod, host)
+ host.__send__(:prepend, mod) unless host < mod
+ end
+ end
+
+ # @private
+ def requires=(paths)
+ directories = ['lib', default_path].select { |p| File.directory? p }
+ RSpec::Core::RubyProject.add_to_load_path(*directories)
+ paths.each { |path| require path }
+ @requires += paths
+ end
+
+ # @private
+ if RUBY_VERSION.to_f >= 1.9
+ # @private
+ def safe_include(mod, host)
+ host.__send__(:include, mod) unless host < mod
+ end
+
+ # @private
+ def safe_extend(mod, host)
+ host.extend(mod) unless host.singleton_class < mod
+ end
+ else # for 1.8.7
+ # :nocov:
+ # @private
+ def safe_include(mod, host)
+ host.__send__(:include, mod) unless host.included_modules.include?(mod)
+ end
+
+ # @private
+ def safe_extend(mod, host)
+ host.extend(mod) unless (class << host; self; end).included_modules.include?(mod)
+ end
+ # :nocov:
+ end
+
+ # @private
+ def configure_mock_framework
+ RSpec::Core::ExampleGroup.__send__(:include, mock_framework)
+ conditionally_disable_mocks_monkey_patching
+ end
+
+ # @private
+ def configure_expectation_framework
+ expectation_frameworks.each do |framework|
+ RSpec::Core::ExampleGroup.__send__(:include, framework)
+ end
+ conditionally_disable_expectations_monkey_patching
+ end
+
+ # @private
+ def load_spec_files
+ files_to_run.uniq.each do |f|
+ file = File.expand_path(f)
+ load file
+ loaded_spec_files << file
+ end
+
+ @spec_files_loaded = true
+ end
+
+ # @private
+ DEFAULT_FORMATTER = lambda { |string| string }
+
+ # Formats the docstring output using the block provided.
+ #
+ # @example
+ # # This will strip the descriptions of both examples and example
+ # # groups.
+ # RSpec.configure do |config|
+ # config.format_docstrings { |s| s.strip }
+ # end
+ def format_docstrings(&block)
+ @format_docstrings_block = block_given? ? block : DEFAULT_FORMATTER
+ end
+
+ # @private
+ def format_docstrings_block
+ @format_docstrings_block ||= DEFAULT_FORMATTER
+ end
+
+ # @private
+ # @macro [attach] delegate_to_ordering_manager
+ # @!method $1
+ def self.delegate_to_ordering_manager(*methods)
+ methods.each do |method|
+ define_method method do |*args, &block|
+ ordering_manager.__send__(method, *args, &block)
+ end
+ end
+ end
+
+ # @macro delegate_to_ordering_manager
+ #
+ # Sets the seed value and sets the default global ordering to random.
+ delegate_to_ordering_manager :seed=
+
+ # @macro delegate_to_ordering_manager
+ # Seed for random ordering (default: generated randomly each run).
+ #
+ # When you run specs with `--order random`, RSpec generates a random seed
+ # for the randomization and prints it to the `output_stream` (assuming
+ # you're using RSpec's built-in formatters). If you discover an ordering
+ # dependency (i.e. examples fail intermittently depending on order), set
+ # this (on Configuration or on the command line with `--seed`) to run
+ # using the same seed while you debug the issue.
+ #
+ # We recommend, actually, that you use the command line approach so you
+ # don't accidentally leave the seed encoded.
+ delegate_to_ordering_manager :seed
+
+ # @macro delegate_to_ordering_manager
+ #
+ # Sets the default global order and, if order is `'rand:'`, also
+ # sets the seed.
+ delegate_to_ordering_manager :order=
+
+ # @macro delegate_to_ordering_manager
+ # Registers a named ordering strategy that can later be
+ # used to order an example group's subgroups by adding
+ # `:order => ` metadata to the example group.
+ #
+ # @param name [Symbol] The name of the ordering.
+ # @yield Block that will order the given examples or example groups
+ # @yieldparam list [Array,
+ # Array] The examples or groups to order
+ # @yieldreturn [Array,
+ # Array] The re-ordered examples or groups
+ #
+ # @example
+ # RSpec.configure do |rspec|
+ # rspec.register_ordering :reverse do |list|
+ # list.reverse
+ # end
+ # end
+ #
+ # describe MyClass, :order => :reverse do
+ # # ...
+ # end
+ #
+ # @note Pass the symbol `:global` to set the ordering strategy that
+ # will be used to order the top-level example groups and any example
+ # groups that do not have declared `:order` metadata.
+ delegate_to_ordering_manager :register_ordering
+
+ # @private
+ delegate_to_ordering_manager :seed_used?, :ordering_registry
+
+ # Set Ruby warnings on or off.
+ def warnings=(value)
+ $VERBOSE = !!value
+ end
+
+ # @return [Boolean] Whether or not ruby warnings are enabled.
+ def warnings?
+ $VERBOSE
+ end
+
+ # Exposes the current running example via the named
+ # helper method. RSpec 2.x exposed this via `example`,
+ # but in RSpec 3.0, the example is instead exposed via
+ # an arg yielded to `it`, `before`, `let`, etc. However,
+ # some extension gems (such as Capybara) depend on the
+ # RSpec 2.x's `example` method, so this config option
+ # can be used to maintain compatibility.
+ #
+ # @param method_name [Symbol] the name of the helper method
+ #
+ # @example
+ #
+ # RSpec.configure do |rspec|
+ # rspec.expose_current_running_example_as :example
+ # end
+ #
+ # describe MyClass do
+ # before do
+ # # `example` can be used here because of the above config.
+ # do_something if example.metadata[:type] == "foo"
+ # end
+ # end
+ def expose_current_running_example_as(method_name)
+ ExposeCurrentExample.module_exec do
+ extend RSpec::SharedContext
+ let(method_name) { |ex| ex }
+ end
+
+ include ExposeCurrentExample
+ end
+
+ # @private
+ module ExposeCurrentExample; end
+
+ # Turns deprecation warnings into errors, in order to surface
+ # the full backtrace of the call site. This can be useful when
+ # you need more context to address a deprecation than the
+ # single-line call site normally provided.
+ #
+ # @example
+ #
+ # RSpec.configure do |rspec|
+ # rspec.raise_errors_for_deprecations!
+ # end
+ def raise_errors_for_deprecations!
+ self.deprecation_stream = Formatters::DeprecationFormatter::RaiseErrorStream.new
+ end
+
+ # Enables zero monkey patching mode for RSpec. It removes monkey
+ # patching of the top-level DSL methods (`describe`,
+ # `shared_examples_for`, etc) onto `main` and `Module`, instead
+ # requiring you to prefix these methods with `RSpec.`. It enables
+ # expect-only syntax for rspec-mocks and rspec-expectations. It
+ # simply disables monkey patching on whatever pieces of RSpec
+ # the user is using.
+ #
+ # @note It configures rspec-mocks and rspec-expectations only
+ # if the user is using those (either explicitly or implicitly
+ # by not setting `mock_with` or `expect_with` to anything else).
+ #
+ # @note If the user uses this options with `mock_with :mocha`
+ # (or similiar) they will still have monkey patching active
+ # in their test environment from mocha.
+ #
+ # @example
+ #
+ # # It disables all monkey patching.
+ # RSpec.configure do |config|
+ # config.disable_monkey_patching!
+ # end
+ #
+ # # Is an equivalent to
+ # RSpec.configure do |config|
+ # config.expose_dsl_globally = false
+ #
+ # config.mock_with :rspec do |mocks|
+ # mocks.syntax = :expect
+ # mocks.patch_marshal_to_support_partial_doubles = false
+ # end
+ #
+ # config.mock_with :rspec do |expectations|
+ # expectations.syntax = :expect
+ # end
+ # end
+ def disable_monkey_patching!
+ self.expose_dsl_globally = false
+ self.disable_monkey_patching = true
+ conditionally_disable_mocks_monkey_patching
+ conditionally_disable_expectations_monkey_patching
+ end
+
+ # @private
+ attr_accessor :disable_monkey_patching
+
+ # Defines a callback that can assign derived metadata values.
+ #
+ # @param filters [Array, Hash] metadata filters that determine
+ # which example or group metadata hashes the callback will be triggered
+ # for. If none are given, the callback will be run against the metadata
+ # hashes of all groups and examples.
+ # @yieldparam metadata [Hash] original metadata hash from an example or
+ # group. Mutate this in your block as needed.
+ #
+ # @example
+ # RSpec.configure do |config|
+ # # Tag all groups and examples in the spec/unit directory with
+ # # :type => :unit
+ # config.define_derived_metadata(:file_path => %r{/spec/unit/}) do |metadata|
+ # metadata[:type] = :unit
+ # end
+ # end
+ def define_derived_metadata(*filters, &block)
+ meta = Metadata.build_hash_from(filters, :warn_about_example_group_filtering)
+ @derived_metadata_blocks.append(block, meta)
+ end
+
+ # @private
+ def apply_derived_metadata_to(metadata)
+ @derived_metadata_blocks.items_for(metadata).each do |block|
+ block.call(metadata)
+ end
+ end
+
+ # Defines a `before` hook. See {Hooks#before} for full docs.
+ #
+ # This method differs from {Hooks#before} in only one way: it supports
+ # the `:suite` scope. Hooks with the `:suite` scope will be run once before
+ # the first example of the entire suite is executed.
+ #
+ # @see #prepend_before
+ # @see #after
+ # @see #append_after
+ def before(*args, &block)
+ handle_suite_hook(args, @before_suite_hooks, :push,
+ Hooks::BeforeHook, block) || super(*args, &block)
+ end
+ alias_method :append_before, :before
+
+ # Adds `block` to the start of the list of `before` blocks in the same
+ # scope (`:example`, `:context`, or `:suite`), in contrast to {#before},
+ # which adds the hook to the end of the list.
+ #
+ # See {Hooks#before} for full `before` hook docs.
+ #
+ # This method differs from {Hooks#prepend_before} in only one way: it supports
+ # the `:suite` scope. Hooks with the `:suite` scope will be run once before
+ # the first example of the entire suite is executed.
+ #
+ # @see #before
+ # @see #after
+ # @see #append_after
+ def prepend_before(*args, &block)
+ handle_suite_hook(args, @before_suite_hooks, :unshift,
+ Hooks::BeforeHook, block) || super(*args, &block)
+ end
+
+ # Defines a `after` hook. See {Hooks#after} for full docs.
+ #
+ # This method differs from {Hooks#after} in only one way: it supports
+ # the `:suite` scope. Hooks with the `:suite` scope will be run once after
+ # the last example of the entire suite is executed.
+ #
+ # @see #append_after
+ # @see #before
+ # @see #prepend_before
+ def after(*args, &block)
+ handle_suite_hook(args, @after_suite_hooks, :unshift,
+ Hooks::AfterHook, block) || super(*args, &block)
+ end
+ alias_method :prepend_after, :after
+
+ # Adds `block` to the end of the list of `after` blocks in the same
+ # scope (`:example`, `:context`, or `:suite`), in contrast to {#after},
+ # which adds the hook to the start of the list.
+ #
+ # See {Hooks#after} for full `after` hook docs.
+ #
+ # This method differs from {Hooks#append_after} in only one way: it supports
+ # the `:suite` scope. Hooks with the `:suite` scope will be run once after
+ # the last example of the entire suite is executed.
+ #
+ # @see #append_after
+ # @see #before
+ # @see #prepend_before
+ def append_after(*args, &block)
+ handle_suite_hook(args, @after_suite_hooks, :push,
+ Hooks::AfterHook, block) || super(*args, &block)
+ end
+
+ # @private
+ def with_suite_hooks
+ return yield if dry_run?
+
+ hook_context = SuiteHookContext.new
+ begin
+ run_hooks_with(@before_suite_hooks, hook_context)
+ yield
+ ensure
+ run_hooks_with(@after_suite_hooks, hook_context)
+ end
+ end
+
+ # @private
+ # Holds the various registered hooks. Here we use a FilterableItemRepository
+ # implementation that is specifically optimized for the read/write patterns
+ # of the config object.
+ def hooks
+ @hooks ||= HookCollections.new(self, FilterableItemRepository::QueryOptimized)
+ end
+
+ private
+
+ def handle_suite_hook(args, collection, append_or_prepend, hook_type, block)
+ scope, meta = *args
+ return nil unless scope == :suite
+
+ if meta
+ # TODO: in RSpec 4, consider raising an error here.
+ # We warn only for backwards compatibility.
+ RSpec.warn_with "WARNING: `:suite` hooks do not support metadata since " \
+ "they apply to the suite as a whole rather than " \
+ "any individual example or example group that has metadata. " \
+ "The metadata you have provided (#{meta.inspect}) will be ignored."
+ end
+
+ collection.__send__(append_or_prepend, hook_type.new(block, {}))
+ end
+
+ def run_hooks_with(hooks, hook_context)
+ hooks.each { |h| h.run(hook_context) }
+ end
+
+ def get_files_to_run(paths)
+ files = FlatMap.flat_map(paths_to_check(paths)) do |path|
+ path = path.gsub(File::ALT_SEPARATOR, File::SEPARATOR) if File::ALT_SEPARATOR
+ File.directory?(path) ? gather_directories(path) : extract_location(path)
+ end.sort.uniq
+
+ return files unless only_failures?
+ relative_files = files.map { |f| Metadata.relative_path(File.expand_path f) }
+ intersection = (relative_files & spec_files_with_failures.to_a)
+ intersection.empty? ? files : intersection
+ end
+
+ def paths_to_check(paths)
+ return paths if pattern_might_load_specs_from_vendored_dirs?
+ paths + [Dir.getwd]
+ end
+
+ def pattern_might_load_specs_from_vendored_dirs?
+ pattern.split(File::SEPARATOR).first.include?('**')
+ end
+
+ def gather_directories(path)
+ include_files = get_matching_files(path, pattern)
+ exclude_files = get_matching_files(path, exclude_pattern)
+ (include_files - exclude_files).sort.uniq
+ end
+
+ def get_matching_files(path, pattern)
+ Dir[file_glob_from(path, pattern)].map { |file| File.expand_path(file) }
+ end
+
+ def file_glob_from(path, pattern)
+ stripped = "{#{pattern.gsub(/\s*,\s*/, ',')}}"
+ return stripped if pattern =~ /^(\.\/)?#{Regexp.escape path}/ || absolute_pattern?(pattern)
+ File.join(path, stripped)
+ end
+
+ if RSpec::Support::OS.windows?
+ # :nocov:
+ def absolute_pattern?(pattern)
+ pattern =~ /\A[A-Z]:\\/ || windows_absolute_network_path?(pattern)
+ end
+
+ def windows_absolute_network_path?(pattern)
+ return false unless ::File::ALT_SEPARATOR
+ pattern.start_with?(::File::ALT_SEPARATOR + ::File::ALT_SEPARATOR)
+ end
+ # :nocov:
+ else
+ def absolute_pattern?(pattern)
+ pattern.start_with?(File::Separator)
+ end
+ end
+
+ # @private
+ ON_SQUARE_BRACKETS = /[\[\]]/
+
+ def extract_location(path)
+ match = /^(.*?)((?:\:\d+)+)$/.match(path)
+
+ if match
+ captures = match.captures
+ path, lines = captures[0], captures[1][1..-1].split(":").map { |n| n.to_i }
+ filter_manager.add_location path, lines
+ else
+ path, scoped_ids = path.split(ON_SQUARE_BRACKETS)
+ filter_manager.add_ids(path, scoped_ids.split(/\s*,\s*/)) if scoped_ids
+ end
+
+ return [] if path == default_path
+ path
+ end
+
+ def command
+ $0.split(File::SEPARATOR).last
+ end
+
+ def value_for(key)
+ @preferred_options.fetch(key) { yield }
+ end
+
+ def define_built_in_hooks
+ around(:example, :aggregate_failures => true) do |procsy|
+ begin
+ aggregate_failures(nil, :hide_backtrace => true, &procsy)
+ rescue Exception => exception
+ procsy.example.set_aggregate_failures_exception(exception)
+ end
+ end
+ end
+
+ def assert_no_example_groups_defined(config_option)
+ return unless RSpec.world.example_groups.any?
+
+ raise MustBeConfiguredBeforeExampleGroupsError.new(
+ "RSpec's #{config_option} configuration option must be configured before " \
+ "any example groups are defined, but you have already defined a group."
+ )
+ end
+
+ def output_to_tty?(output=output_stream)
+ tty? || (output.respond_to?(:tty?) && output.tty?)
+ end
+
+ def conditionally_disable_mocks_monkey_patching
+ return unless disable_monkey_patching && rspec_mocks_loaded?
+
+ RSpec::Mocks.configuration.tap do |config|
+ config.syntax = :expect
+ config.patch_marshal_to_support_partial_doubles = false
+ end
+ end
+
+ def conditionally_disable_expectations_monkey_patching
+ return unless disable_monkey_patching && rspec_expectations_loaded?
+
+ RSpec::Expectations.configuration.syntax = :expect
+ end
+
+ def rspec_mocks_loaded?
+ defined?(RSpec::Mocks.configuration)
+ end
+
+ def rspec_expectations_loaded?
+ defined?(RSpec::Expectations.configuration)
+ end
+
+ def update_pattern_attr(name, value)
+ if @spec_files_loaded
+ RSpec.warning "Configuring `#{name}` to #{value} has no effect since " \
+ "RSpec has already loaded the spec files."
+ end
+
+ instance_variable_set(:"@#{name}", value)
+ @files_to_run = nil
+ end
+
+ def clear_values_derived_from_example_status_persistence_file_path
+ @last_run_statuses = nil
+ @spec_files_with_failures = nil
+ end
+ end
+ # rubocop:enable Style/ClassLength
+ end
+end
diff --git a/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/configuration_options.rb b/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/configuration_options.rb
new file mode 100644
index 0000000..86dee41
--- /dev/null
+++ b/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/configuration_options.rb
@@ -0,0 +1,191 @@
+require 'erb'
+require 'shellwords'
+
+module RSpec
+ module Core
+ # Responsible for utilizing externally provided configuration options,
+ # whether via the command line, `.rspec`, `~/.rspec`, `.rspec-local`
+ # or a custom options file.
+ class ConfigurationOptions
+ # @param args [Array] command line arguments
+ def initialize(args)
+ @args = args.dup
+ organize_options
+ end
+
+ # Updates the provided {Configuration} instance based on the provided
+ # external configuration options.
+ #
+ # @param config [Configuration] the configuration instance to update
+ def configure(config)
+ process_options_into config
+ configure_filter_manager config.filter_manager
+ load_formatters_into config
+ end
+
+ # @api private
+ # Updates the provided {FilterManager} based on the filter options.
+ # @param filter_manager [FilterManager] instance to update
+ def configure_filter_manager(filter_manager)
+ @filter_manager_options.each do |command, value|
+ filter_manager.__send__ command, value
+ end
+ end
+
+ # @return [Hash] the final merged options, drawn from all external sources
+ attr_reader :options
+
+ private
+
+ def organize_options
+ @filter_manager_options = []
+
+ @options = (file_options << command_line_options << env_options).each do |opts|
+ @filter_manager_options << [:include, opts.delete(:inclusion_filter)] if opts.key?(:inclusion_filter)
+ @filter_manager_options << [:exclude, opts.delete(:exclusion_filter)] if opts.key?(:exclusion_filter)
+ end
+
+ @options = @options.inject(:libs => [], :requires => []) do |hash, opts|
+ hash.merge(opts) do |key, oldval, newval|
+ [:libs, :requires].include?(key) ? oldval + newval : newval
+ end
+ end
+ end
+
+ UNFORCED_OPTIONS = Set.new([
+ :requires, :profile, :drb, :libs, :files_or_directories_to_run,
+ :full_description, :full_backtrace, :tty
+ ])
+
+ UNPROCESSABLE_OPTIONS = Set.new([:formatters])
+
+ def force?(key)
+ !UNFORCED_OPTIONS.include?(key)
+ end
+
+ def order(keys)
+ OPTIONS_ORDER.reverse.each do |key|
+ keys.unshift(key) if keys.delete(key)
+ end
+ keys
+ end
+
+ OPTIONS_ORDER = [
+ # It's important to set this before anything that might issue a
+ # deprecation (or otherwise access the reporter).
+ :deprecation_stream,
+
+ # load paths depend on nothing, but must be set before `requires`
+ # to support load-path-relative requires.
+ :libs,
+
+ # `files_or_directories_to_run` uses `default_path` so it must be
+ # set before it.
+ :default_path, :only_failures,
+
+ # These must be set before `requires` to support checking
+ # `config.files_to_run` from within `spec_helper.rb` when a
+ # `-rspec_helper` option is used.
+ :files_or_directories_to_run, :pattern, :exclude_pattern,
+
+ # Necessary so that the `--seed` option is applied before requires,
+ # in case required files do something with the provided seed.
+ # (such as seed global randomization with it).
+ :order,
+
+ # In general, we want to require the specified files as early as
+ # possible. The `--require` option is specifically intended to allow
+ # early requires. For later requires, they can just put the require in
+ # their spec files, but `--require` provides a unique opportunity for
+ # users to instruct RSpec to load an extension file early for maximum
+ # flexibility.
+ :requires
+ ]
+
+ def process_options_into(config)
+ opts = options.reject { |k, _| UNPROCESSABLE_OPTIONS.include? k }
+
+ order(opts.keys).each do |key|
+ force?(key) ? config.force(key => opts[key]) : config.__send__("#{key}=", opts[key])
+ end
+ end
+
+ def load_formatters_into(config)
+ options[:formatters].each { |pair| config.add_formatter(*pair) } if options[:formatters]
+ end
+
+ def file_options
+ custom_options_file ? [custom_options] : [global_options, project_options, local_options]
+ end
+
+ def env_options
+ return {} unless ENV['SPEC_OPTS']
+
+ parse_args_ignoring_files_or_dirs_to_run(
+ Shellwords.split(ENV["SPEC_OPTS"]),
+ "ENV['SPEC_OPTS']"
+ )
+ end
+
+ def command_line_options
+ @command_line_options ||= Parser.parse(@args)
+ end
+
+ def custom_options
+ options_from(custom_options_file)
+ end
+
+ def local_options
+ @local_options ||= options_from(local_options_file)
+ end
+
+ def project_options
+ @project_options ||= options_from(project_options_file)
+ end
+
+ def global_options
+ @global_options ||= options_from(global_options_file)
+ end
+
+ def options_from(path)
+ args = args_from_options_file(path)
+ parse_args_ignoring_files_or_dirs_to_run(args, path)
+ end
+
+ def parse_args_ignoring_files_or_dirs_to_run(args, source)
+ options = Parser.parse(args, source)
+ options.delete(:files_or_directories_to_run)
+ options
+ end
+
+ def args_from_options_file(path)
+ return [] unless path && File.exist?(path)
+ config_string = options_file_as_erb_string(path)
+ FlatMap.flat_map(config_string.split(/\n+/), &:shellsplit)
+ end
+
+ def options_file_as_erb_string(path)
+ ERB.new(File.read(path), nil, '-').result(binding)
+ end
+
+ def custom_options_file
+ command_line_options[:custom_options_file]
+ end
+
+ def project_options_file
+ "./.rspec"
+ end
+
+ def local_options_file
+ "./.rspec-local"
+ end
+
+ def global_options_file
+ File.join(File.expand_path("~"), ".rspec")
+ rescue ArgumentError
+ RSpec.warning "Unable to find ~/.rspec because the HOME environment variable is not set"
+ nil
+ end
+ end
+ end
+end
diff --git a/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/drb.rb b/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/drb.rb
new file mode 100644
index 0000000..55e6392
--- /dev/null
+++ b/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/drb.rb
@@ -0,0 +1,111 @@
+require 'drb/drb'
+
+module RSpec
+ module Core
+ # @private
+ class DRbRunner
+ def initialize(options, configuration=RSpec.configuration)
+ @options = options
+ @configuration = configuration
+ end
+
+ def drb_port
+ @options.options[:drb_port] || ENV['RSPEC_DRB'] || 8989
+ end
+
+ def run(err, out)
+ begin
+ DRb.start_service("druby://localhost:0")
+ rescue SocketError, Errno::EADDRNOTAVAIL
+ DRb.start_service("druby://:0")
+ end
+ spec_server = DRbObject.new_with_uri("druby://127.0.0.1:#{drb_port}")
+ spec_server.run(drb_argv, err, out)
+ end
+
+ def drb_argv
+ @drb_argv ||= begin
+ @options.configure_filter_manager(@configuration.filter_manager)
+ DRbOptions.new(@options.options, @configuration.filter_manager).options
+ end
+ end
+ end
+
+ # @private
+ class DRbOptions
+ def initialize(submitted_options, filter_manager)
+ @submitted_options = submitted_options
+ @filter_manager = filter_manager
+ end
+
+ def options
+ argv = []
+ argv << "--color" if @submitted_options[:color]
+ argv << "--profile" if @submitted_options[:profile_examples]
+ argv << "--backtrace" if @submitted_options[:full_backtrace]
+ argv << "--tty" if @submitted_options[:tty]
+ argv << "--fail-fast" if @submitted_options[:fail_fast]
+ argv << "--options" << @submitted_options[:custom_options_file] if @submitted_options[:custom_options_file]
+ argv << "--order" << @submitted_options[:order] if @submitted_options[:order]
+
+ add_failure_exit_code(argv)
+ add_full_description(argv)
+ add_filter(argv, :inclusion, @filter_manager.inclusions)
+ add_filter(argv, :exclusion, @filter_manager.exclusions)
+ add_formatters(argv)
+ add_libs(argv)
+ add_requires(argv)
+
+ argv + @submitted_options[:files_or_directories_to_run]
+ end
+
+ def add_failure_exit_code(argv)
+ return unless @submitted_options[:failure_exit_code]
+
+ argv << "--failure-exit-code" << @submitted_options[:failure_exit_code].to_s
+ end
+
+ def add_full_description(argv)
+ return unless @submitted_options[:full_description]
+
+ # The argument to --example is regexp-escaped before being stuffed
+ # into a regexp when received for the first time (see OptionParser).
+ # Hence, merely grabbing the source of this regexp will retain the
+ # backslashes, so we must remove them.
+ @submitted_options[:full_description].each do |description|
+ argv << "--example" << description.source.delete('\\')
+ end
+ end
+
+ CONDITIONAL_FILTERS = [:if, :unless]
+
+ def add_filter(argv, name, hash)
+ hash.each_pair do |k, v|
+ next if CONDITIONAL_FILTERS.include?(k)
+ tag = name == :inclusion ? k.to_s : "~#{k}"
+ tag << ":#{v}" if v.is_a?(String)
+ argv << "--tag" << tag
+ end unless hash.empty?
+ end
+
+ def add_formatters(argv)
+ @submitted_options[:formatters].each do |pair|
+ argv << "--format" << pair[0]
+ argv << "--out" << pair[1] if pair[1]
+ end if @submitted_options[:formatters]
+ end
+
+ def add_libs(argv)
+ @submitted_options[:libs].each do |path|
+ argv << "-I" << path
+ end if @submitted_options[:libs]
+ end
+
+ def add_requires(argv)
+ @submitted_options[:requires].each do |path|
+ argv << "--require" << path
+ end if @submitted_options[:requires]
+ end
+ end
+ end
+end
diff --git a/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/dsl.rb b/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/dsl.rb
new file mode 100644
index 0000000..9f290b9
--- /dev/null
+++ b/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/dsl.rb
@@ -0,0 +1,96 @@
+module RSpec
+ module Core
+ # DSL defines methods to group examples, most notably `describe`,
+ # and exposes them as class methods of {RSpec}. They can also be
+ # exposed globally (on `main` and instances of `Module`) through
+ # the {Configuration} option `expose_dsl_globally`.
+ #
+ # By default the methods `describe`, `context` and `example_group`
+ # are exposed. These methods define a named context for one or
+ # more examples. The given block is evaluated in the context of
+ # a generated subclass of {RSpec::Core::ExampleGroup}.
+ #
+ # ## Examples:
+ #
+ # RSpec.describe "something" do
+ # context "when something is a certain way" do
+ # it "does something" do
+ # # example code goes here
+ # end
+ # end
+ # end
+ #
+ # @see ExampleGroup
+ # @see ExampleGroup.example_group
+ module DSL
+ # @private
+ def self.example_group_aliases
+ @example_group_aliases ||= []
+ end
+
+ # @private
+ def self.exposed_globally?
+ @exposed_globally ||= false
+ end
+
+ # @private
+ def self.expose_example_group_alias(name)
+ return if example_group_aliases.include?(name)
+
+ example_group_aliases << name
+
+ (class << RSpec; self; end).__send__(:define_method, name) do |*args, &example_group_block|
+ RSpec.world.register RSpec::Core::ExampleGroup.__send__(name, *args, &example_group_block)
+ end
+
+ expose_example_group_alias_globally(name) if exposed_globally?
+ end
+
+ class << self
+ # @private
+ attr_accessor :top_level
+ end
+
+ # Adds the describe method to Module and the top level binding.
+ # @api private
+ def self.expose_globally!
+ return if exposed_globally?
+
+ example_group_aliases.each do |method_name|
+ expose_example_group_alias_globally(method_name)
+ end
+
+ @exposed_globally = true
+ end
+
+ # Removes the describe method from Module and the top level binding.
+ # @api private
+ def self.remove_globally!
+ return unless exposed_globally?
+
+ example_group_aliases.each do |method_name|
+ change_global_dsl { undef_method method_name }
+ end
+
+ @exposed_globally = false
+ end
+
+ # @private
+ def self.expose_example_group_alias_globally(method_name)
+ change_global_dsl do
+ remove_method(method_name) if method_defined?(method_name)
+ define_method(method_name) { |*a, &b| ::RSpec.__send__(method_name, *a, &b) }
+ end
+ end
+
+ # @private
+ def self.change_global_dsl(&changes)
+ (class << top_level; self; end).class_exec(&changes)
+ Module.class_exec(&changes)
+ end
+ end
+ end
+end
+
+# Capture main without an eval.
+::RSpec::Core::DSL.top_level = self
diff --git a/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/example.rb b/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/example.rb
new file mode 100644
index 0000000..3b46ed8
--- /dev/null
+++ b/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/example.rb
@@ -0,0 +1,573 @@
+module RSpec
+ module Core
+ # Wrapper for an instance of a subclass of {ExampleGroup}. An instance of
+ # `RSpec::Core::Example` is returned by example definition methods
+ # such as {ExampleGroup.it it} and is yielded to the {ExampleGroup.it it},
+ # {Hooks#before before}, {Hooks#after after}, {Hooks#around around},
+ # {MemoizedHelpers::ClassMethods#let let} and
+ # {MemoizedHelpers::ClassMethods#subject subject} blocks.
+ #
+ # This allows us to provide rich metadata about each individual
+ # example without adding tons of methods directly to the ExampleGroup
+ # that users may inadvertantly redefine.
+ #
+ # Useful for configuring logging and/or taking some action based
+ # on the state of an example's metadata.
+ #
+ # @example
+ #
+ # RSpec.configure do |config|
+ # config.before do |example|
+ # log example.description
+ # end
+ #
+ # config.after do |example|
+ # log example.description
+ # end
+ #
+ # config.around do |example|
+ # log example.description
+ # example.run
+ # end
+ # end
+ #
+ # shared_examples "auditable" do
+ # it "does something" do
+ # log "#{example.full_description}: #{auditable.inspect}"
+ # auditable.should do_something
+ # end
+ # end
+ #
+ # @see ExampleGroup
+ # @note Example blocks are evaluated in the context of an instance
+ # of an `ExampleGroup`, not in the context of an instance of `Example`.
+ class Example
+ # @private
+ #
+ # Used to define methods that delegate to this example's metadata.
+ def self.delegate_to_metadata(key)
+ define_method(key) { @metadata[key] }
+ end
+
+ # @return [ExecutionResult] represents the result of running this example.
+ delegate_to_metadata :execution_result
+ # @return [String] the relative path to the file where this example was
+ # defined.
+ delegate_to_metadata :file_path
+ # @return [String] the full description (including the docstrings of
+ # all parent example groups).
+ delegate_to_metadata :full_description
+ # @return [String] the exact source location of this example in a form
+ # like `./path/to/spec.rb:17`
+ delegate_to_metadata :location
+ # @return [Boolean] flag that indicates that the example is not expected
+ # to pass. It will be run and will either have a pending result (if a
+ # failure occurs) or a failed result (if no failure occurs).
+ delegate_to_metadata :pending
+ # @return [Boolean] flag that will cause the example to not run.
+ # The {ExecutionResult} status will be `:pending`.
+ delegate_to_metadata :skip
+
+ # Returns the string submitted to `example` or its aliases (e.g.
+ # `specify`, `it`, etc). If no string is submitted (e.g.
+ # `it { is_expected.to do_something }`) it returns the message generated
+ # by the matcher if there is one, otherwise returns a message including
+ # the location of the example.
+ def description
+ description = if metadata[:description].to_s.empty?
+ location_description
+ else
+ metadata[:description]
+ end
+
+ RSpec.configuration.format_docstrings_block.call(description)
+ end
+
+ # Returns a description of the example that always includes the location.
+ def inspect_output
+ inspect_output = "\"#{description}\""
+ unless metadata[:description].to_s.empty?
+ inspect_output << " (#{location})"
+ end
+ inspect_output
+ end
+
+ # Returns the location-based argument that can be passed to the `rspec` command to rerun this example.
+ def location_rerun_argument
+ @location_rerun_argument ||= begin
+ loaded_spec_files = RSpec.configuration.loaded_spec_files
+
+ Metadata.ascending(metadata) do |meta|
+ return meta[:location] if loaded_spec_files.include?(meta[:absolute_file_path])
+ end
+ end
+ end
+
+ # Returns the location-based argument that can be passed to the `rspec` command to rerun this example.
+ #
+ # @deprecated Use {#location_rerun_argument} instead.
+ # @note If there are multiple examples identified by this location, they will use {#id}
+ # to rerun instead, but this method will still return the location (that's why it is deprecated!).
+ def rerun_argument
+ location_rerun_argument
+ end
+
+ # @return [String] the unique id of this example. Pass
+ # this at the command line to re-run this exact example.
+ def id
+ @id ||= Metadata.id_from(metadata)
+ end
+
+ # @attr_reader
+ #
+ # Returns the first exception raised in the context of running this
+ # example (nil if no exception is raised).
+ attr_reader :exception
+
+ # @attr_reader
+ #
+ # Returns the metadata object associated with this example.
+ attr_reader :metadata
+
+ # @attr_reader
+ # @private
+ #
+ # Returns the example_group_instance that provides the context for
+ # running this example.
+ attr_reader :example_group_instance
+
+ # @attr
+ # @private
+ attr_accessor :clock
+
+ # Creates a new instance of Example.
+ # @param example_group_class [Class] the subclass of ExampleGroup in which
+ # this Example is declared
+ # @param description [String] the String passed to the `it` method (or
+ # alias)
+ # @param user_metadata [Hash] additional args passed to `it` to be used as
+ # metadata
+ # @param example_block [Proc] the block of code that represents the
+ # example
+ # @api private
+ def initialize(example_group_class, description, user_metadata, example_block=nil)
+ @example_group_class = example_group_class
+ @example_block = example_block
+
+ @metadata = Metadata::ExampleHash.create(
+ @example_group_class.metadata, user_metadata,
+ example_group_class.method(:next_runnable_index_for),
+ description, example_block
+ )
+
+ # This should perhaps be done in `Metadata::ExampleHash.create`,
+ # but the logic there has no knowledge of `RSpec.world` and we
+ # want to keep it that way. It's easier to just assign it here.
+ @metadata[:last_run_status] = RSpec.configuration.last_run_statuses[id]
+
+ @example_group_instance = @exception = nil
+ @clock = RSpec::Core::Time
+ @reporter = RSpec::Core::NullReporter
+ end
+
+ # @return [RSpec::Core::Reporter] the current reporter for the example
+ attr_reader :reporter
+
+ # Returns the example group class that provides the context for running
+ # this example.
+ def example_group
+ @example_group_class
+ end
+
+ alias_method :pending?, :pending
+ alias_method :skipped?, :skip
+
+ # @api private
+ # instance_execs the block passed to the constructor in the context of
+ # the instance of {ExampleGroup}.
+ # @param example_group_instance the instance of an ExampleGroup subclass
+ def run(example_group_instance, reporter)
+ @example_group_instance = example_group_instance
+ @reporter = reporter
+ hooks.register_global_singleton_context_hooks(self, RSpec.configuration.hooks)
+ RSpec.configuration.configure_example(self)
+ RSpec.current_example = self
+
+ start(reporter)
+ Pending.mark_pending!(self, pending) if pending?
+
+ begin
+ if skipped?
+ Pending.mark_pending! self, skip
+ elsif !RSpec.configuration.dry_run?
+ with_around_and_singleton_context_hooks do
+ begin
+ run_before_example
+ @example_group_instance.instance_exec(self, &@example_block)
+
+ if pending?
+ Pending.mark_fixed! self
+
+ raise Pending::PendingExampleFixedError,
+ 'Expected example to fail since it is pending, but it passed.',
+ [location]
+ end
+ rescue Pending::SkipDeclaredInExample
+ # no-op, required metadata has already been set by the `skip`
+ # method.
+ rescue Exception => e
+ set_exception(e)
+ ensure
+ run_after_example
+ end
+ end
+ end
+ rescue Exception => e
+ set_exception(e)
+ ensure
+ @example_group_instance = nil # if you love something... let it go
+ end
+
+ finish(reporter)
+ ensure
+ RSpec.current_example = nil
+ end
+
+ # Wraps both a `Proc` and an {Example} for use in {Hooks#around
+ # around} hooks. In around hooks we need to yield this special
+ # kind of object (rather than the raw {Example}) because when
+ # there are multiple `around` hooks we have to wrap them recursively.
+ #
+ # @example
+ #
+ # RSpec.configure do |c|
+ # c.around do |ex| # Procsy which wraps the example
+ # if ex.metadata[:key] == :some_value && some_global_condition
+ # raise "some message"
+ # end
+ # ex.run # run delegates to ex.call.
+ # end
+ # end
+ #
+ # @note This class also exposes the instance methods of {Example},
+ # proxying them through to the wrapped {Example} instance.
+ class Procsy
+ # The {Example} instance.
+ attr_reader :example
+
+ Example.public_instance_methods(false).each do |name|
+ next if name.to_sym == :run || name.to_sym == :inspect
+
+ define_method(name) { |*a, &b| @example.__send__(name, *a, &b) }
+ end
+
+ Proc.public_instance_methods(false).each do |name|
+ next if name.to_sym == :call || name.to_sym == :inspect || name.to_sym == :to_proc
+
+ define_method(name) { |*a, &b| @proc.__send__(name, *a, &b) }
+ end
+
+ # Calls the proc and notes that the example has been executed.
+ def call(*args, &block)
+ @executed = true
+ @proc.call(*args, &block)
+ end
+ alias run call
+
+ # Provides a wrapped proc that will update our `executed?` state when
+ # executed.
+ def to_proc
+ method(:call).to_proc
+ end
+
+ def initialize(example, &block)
+ @example = example
+ @proc = block
+ @executed = false
+ end
+
+ # @private
+ def wrap(&block)
+ self.class.new(example, &block)
+ end
+
+ # Indicates whether or not the around hook has executed the example.
+ def executed?
+ @executed
+ end
+
+ # @private
+ def inspect
+ @example.inspect.gsub('Example', 'ExampleProcsy')
+ end
+ end
+
+ # @private
+ #
+ # The exception that will be displayed to the user -- either the failure of
+ # the example or the `pending_exception` if the example is pending.
+ def display_exception
+ @exception || execution_result.pending_exception
+ end
+
+ # @private
+ #
+ # Assigns the exception that will be displayed to the user -- either the failure of
+ # the example or the `pending_exception` if the example is pending.
+ def display_exception=(ex)
+ if pending? && !(Pending::PendingExampleFixedError === ex)
+ @exception = nil
+ execution_result.pending_fixed = false
+ execution_result.pending_exception = ex
+ else
+ @exception = ex
+ end
+ end
+
+ # rubocop:disable Style/AccessorMethodName
+
+ # @private
+ #
+ # Used internally to set an exception in an after hook, which
+ # captures the exception but doesn't raise it.
+ def set_exception(exception)
+ return self.display_exception = exception unless display_exception
+
+ unless RSpec::Core::MultipleExceptionError === display_exception
+ self.display_exception = RSpec::Core::MultipleExceptionError.new(display_exception)
+ end
+
+ display_exception.add exception
+ end
+
+ # @private
+ #
+ # Used to set the exception when `aggregate_failures` fails.
+ def set_aggregate_failures_exception(exception)
+ return set_exception(exception) unless display_exception
+
+ exception = RSpec::Core::MultipleExceptionError::InterfaceTag.for(exception)
+ exception.add display_exception
+ self.display_exception = exception
+ end
+
+ # rubocop:enable Style/AccessorMethodName
+
+ # @private
+ #
+ # Used internally to set an exception and fail without actually executing
+ # the example when an exception is raised in before(:context).
+ def fail_with_exception(reporter, exception)
+ start(reporter)
+ set_exception(exception)
+ finish(reporter)
+ end
+
+ # @private
+ #
+ # Used internally to skip without actually executing the example when
+ # skip is used in before(:context).
+ def skip_with_exception(reporter, exception)
+ start(reporter)
+ Pending.mark_skipped! self, exception.argument
+ finish(reporter)
+ end
+
+ # @private
+ def instance_exec(*args, &block)
+ @example_group_instance.instance_exec(*args, &block)
+ end
+
+ private
+
+ def hooks
+ example_group_instance.singleton_class.hooks
+ end
+
+ def with_around_example_hooks
+ hooks.run(:around, :example, self) { yield }
+ rescue Exception => e
+ set_exception(e)
+ end
+
+ def start(reporter)
+ reporter.example_started(self)
+ execution_result.started_at = clock.now
+ end
+
+ def finish(reporter)
+ pending_message = execution_result.pending_message
+
+ if @exception
+ record_finished :failed
+ execution_result.exception = @exception
+ reporter.example_failed self
+ false
+ elsif pending_message
+ record_finished :pending
+ execution_result.pending_message = pending_message
+ reporter.example_pending self
+ true
+ else
+ record_finished :passed
+ reporter.example_passed self
+ true
+ end
+ end
+
+ def record_finished(status)
+ execution_result.record_finished(status, clock.now)
+ end
+
+ def run_before_example
+ @example_group_instance.setup_mocks_for_rspec
+ hooks.run(:before, :example, self)
+ end
+
+ def with_around_and_singleton_context_hooks
+ singleton_context_hooks_host = example_group_instance.singleton_class
+ singleton_context_hooks_host.run_before_context_hooks(example_group_instance)
+ with_around_example_hooks { yield }
+ ensure
+ singleton_context_hooks_host.run_after_context_hooks(example_group_instance)
+ end
+
+ def run_after_example
+ assign_generated_description if defined?(::RSpec::Matchers)
+ hooks.run(:after, :example, self)
+ verify_mocks
+ ensure
+ @example_group_instance.teardown_mocks_for_rspec
+ end
+
+ def verify_mocks
+ @example_group_instance.verify_mocks_for_rspec if mocks_need_verification?
+ rescue Exception => e
+ set_exception(e)
+ end
+
+ def mocks_need_verification?
+ exception.nil? || execution_result.pending_fixed?
+ end
+
+ def assign_generated_description
+ if metadata[:description].empty? && (description = generate_description)
+ metadata[:description] = description
+ metadata[:full_description] << description
+ end
+ ensure
+ RSpec::Matchers.clear_generated_description
+ end
+
+ def generate_description
+ RSpec::Matchers.generated_description
+ rescue Exception => e
+ location_description + " (Got an error when generating description " \
+ "from matcher: #{e.class}: #{e.message} -- #{e.backtrace.first})"
+ end
+
+ def location_description
+ "example at #{location}"
+ end
+
+ # Represents the result of executing an example.
+ # Behaves like a hash for backwards compatibility.
+ class ExecutionResult
+ include HashImitatable
+
+ # @return [Symbol] `:passed`, `:failed` or `:pending`.
+ attr_accessor :status
+
+ # @return [Exception, nil] The failure, if there was one.
+ attr_accessor :exception
+
+ # @return [Time] When the example started.
+ attr_accessor :started_at
+
+ # @return [Time] When the example finished.
+ attr_accessor :finished_at
+
+ # @return [Float] How long the example took in seconds.
+ attr_accessor :run_time
+
+ # @return [String, nil] The reason the example was pending,
+ # or nil if the example was not pending.
+ attr_accessor :pending_message
+
+ # @return [Exception, nil] The exception triggered while
+ # executing the pending example. If no exception was triggered
+ # it would no longer get a status of `:pending` unless it was
+ # tagged with `:skip`.
+ attr_accessor :pending_exception
+
+ # @return [Boolean] For examples tagged with `:pending`,
+ # this indicates whether or not it now passes.
+ attr_accessor :pending_fixed
+
+ alias pending_fixed? pending_fixed
+
+ # @return [Boolean] Indicates if the example was completely skipped
+ # (typically done via `:skip` metadata or the `skip` method). Skipped examples
+ # will have a `:pending` result. A `:pending` result can also come from examples
+ # that were marked as `:pending`, which causes them to be run, and produces a
+ # `:failed` result if the example passes.
+ def example_skipped?
+ status == :pending && !pending_exception
+ end
+
+ # @api private
+ # Records the finished status of the example.
+ def record_finished(status, finished_at)
+ self.status = status
+ self.finished_at = finished_at
+ self.run_time = (finished_at - started_at).to_f
+ end
+
+ private
+
+ # For backwards compatibility we present `status` as a string
+ # when presenting the legacy hash interface.
+ def hash_for_delegation
+ super.tap do |hash|
+ hash[:status] &&= status.to_s
+ end
+ end
+
+ def set_value(name, value)
+ value &&= value.to_sym if name == :status
+ super(name, value)
+ end
+
+ def get_value(name)
+ if name == :status
+ status.to_s if status
+ else
+ super
+ end
+ end
+
+ def issue_deprecation(_method_name, *_args)
+ RSpec.deprecate("Treating `metadata[:execution_result]` as a hash",
+ :replacement => "the attributes methods to access the data")
+ end
+ end
+ end
+
+ # @private
+ # Provides an execution context for before/after :suite hooks.
+ class SuiteHookContext < Example
+ def initialize
+ super(AnonymousExampleGroup, "", {})
+ @example_group_instance = AnonymousExampleGroup.new
+ end
+
+ # rubocop:disable Style/AccessorMethodName
+
+ # To ensure we don't silence errors.
+ def set_exception(exception)
+ raise exception
+ end
+ # rubocop:enable Style/AccessorMethodName
+ end
+ end
+end
diff --git a/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/example_group.rb b/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/example_group.rb
new file mode 100644
index 0000000..9752955
--- /dev/null
+++ b/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/example_group.rb
@@ -0,0 +1,796 @@
+RSpec::Support.require_rspec_support 'recursive_const_methods'
+
+module RSpec
+ module Core
+ # ExampleGroup and {Example} are the main structural elements of
+ # rspec-core. Consider this example:
+ #
+ # describe Thing do
+ # it "does something" do
+ # end
+ # end
+ #
+ # The object returned by `describe Thing` is a subclass of ExampleGroup.
+ # The object returned by `it "does something"` is an instance of Example,
+ # which serves as a wrapper for an instance of the ExampleGroup in which it
+ # is declared.
+ #
+ # Example group bodies (e.g. `describe` or `context` blocks) are evaluated
+ # in the context of a new subclass of ExampleGroup. Individual examples are
+ # evaluated in the context of an instance of the specific ExampleGroup
+ # subclass to which they belong.
+ #
+ # Besides the class methods defined here, there are other interesting macros
+ # defined in {Hooks}, {MemoizedHelpers::ClassMethods} and
+ # {SharedExampleGroup}. There are additional instance methods available to
+ # your examples defined in {MemoizedHelpers} and {Pending}.
+ class ExampleGroup
+ extend Hooks
+
+ include MemoizedHelpers
+ extend MemoizedHelpers::ClassMethods
+ include Pending
+ extend SharedExampleGroup
+
+ # @private
+ def self.idempotently_define_singleton_method(name, &definition)
+ (class << self; self; end).module_exec do
+ remove_method(name) if method_defined?(name) && instance_method(name).owner == self
+ define_method(name, &definition)
+ end
+ end
+
+ # @!group Metadata
+
+ # The [Metadata](Metadata) object associated with this group.
+ # @see Metadata
+ def self.metadata
+ @metadata ||= nil
+ end
+
+ # Temporarily replace the provided metadata.
+ # Intended primarily to allow an example group's singleton class
+ # to return the metadata of the example that it exists for. This
+ # is necessary for shared example group inclusion to work properly
+ # with singleton example groups.
+ # @private
+ def self.with_replaced_metadata(meta)
+ orig_metadata = metadata
+ @metadata = meta
+ yield
+ ensure
+ @metadata = orig_metadata
+ end
+
+ # @private
+ # @return [Metadata] belonging to the parent of a nested {ExampleGroup}
+ def self.superclass_metadata
+ @superclass_metadata ||= superclass.respond_to?(:metadata) ? superclass.metadata : nil
+ end
+
+ # @private
+ def self.delegate_to_metadata(*names)
+ names.each do |name|
+ idempotently_define_singleton_method(name) { metadata.fetch(name) }
+ end
+ end
+
+ delegate_to_metadata :described_class, :file_path, :location
+
+ # @return [String] the current example group description
+ def self.description
+ description = metadata[:description]
+ RSpec.configuration.format_docstrings_block.call(description)
+ end
+
+ # Returns the class or module passed to the `describe` method (or alias).
+ # Returns nil if the subject is not a class or module.
+ # @example
+ # describe Thing do
+ # it "does something" do
+ # described_class == Thing
+ # end
+ # end
+ #
+ def described_class
+ self.class.described_class
+ end
+
+ # @!endgroup
+
+ # @!group Defining Examples
+
+ # @private
+ # @macro [attach] define_example_method
+ # @!scope class
+ # @overload $1
+ # @overload $1(&example_implementation)
+ # @param example_implementation [Block] The implementation of the example.
+ # @overload $1(doc_string, *metadata_keys, metadata={})
+ # @param doc_string [String] The example's doc string.
+ # @param metadata [Hash] Metadata for the example.
+ # @param metadata_keys [Array] Metadata tags for the example.
+ # Will be transformed into hash entries with `true` values.
+ # @overload $1(doc_string, *metadata_keys, metadata={}, &example_implementation)
+ # @param doc_string [String] The example's doc string.
+ # @param metadata [Hash] Metadata for the example.
+ # @param metadata_keys [Array] Metadata tags for the example.
+ # Will be transformed into hash entries with `true` values.
+ # @param example_implementation [Block] The implementation of the example.
+ # @yield [Example] the example object
+ # @example
+ # $1 do
+ # end
+ #
+ # $1 "does something" do
+ # end
+ #
+ # $1 "does something", :slow, :uses_js do
+ # end
+ #
+ # $1 "does something", :with => 'additional metadata' do
+ # end
+ #
+ # $1 "does something" do |ex|
+ # # ex is the Example object that contains metadata about the example
+ # end
+ def self.define_example_method(name, extra_options={})
+ idempotently_define_singleton_method(name) do |*all_args, &block|
+ desc, *args = *all_args
+
+ options = Metadata.build_hash_from(args)
+ options.update(:skip => RSpec::Core::Pending::NOT_YET_IMPLEMENTED) unless block
+ options.update(extra_options)
+
+ example = RSpec::Core::Example.new(self, desc, options, block)
+ examples << example
+ example
+ end
+ end
+
+ # Defines an example within a group.
+ define_example_method :example
+ # Defines an example within a group.
+ # This is the primary API to define a code example.
+ define_example_method :it
+ # Defines an example within a group.
+ # Useful for when your docstring does not read well off of `it`.
+ # @example
+ # RSpec.describe MyClass do
+ # specify "#do_something is deprecated" do
+ # # ...
+ # end
+ # end
+ define_example_method :specify
+
+ # Shortcut to define an example with `:focus => true`.
+ # @see example
+ define_example_method :focus, :focus => true
+ # Shortcut to define an example with `:focus => true`.
+ # @see example
+ define_example_method :fexample, :focus => true
+ # Shortcut to define an example with `:focus => true`.
+ # @see example
+ define_example_method :fit, :focus => true
+ # Shortcut to define an example with `:focus => true`.
+ # @see example
+ define_example_method :fspecify, :focus => true
+ # Shortcut to define an example with `:skip => 'Temporarily skipped with xexample'`.
+ # @see example
+ define_example_method :xexample, :skip => 'Temporarily skipped with xexample'
+ # Shortcut to define an example with `:skip => 'Temporarily skipped with xit'`.
+ # @see example
+ define_example_method :xit, :skip => 'Temporarily skipped with xit'
+ # Shortcut to define an example with `:skip => 'Temporarily skipped with xspecify'`.
+ # @see example
+ define_example_method :xspecify, :skip => 'Temporarily skipped with xspecify'
+ # Shortcut to define an example with `:skip => true`
+ # @see example
+ define_example_method :skip, :skip => true
+ # Shortcut to define an example with `:pending => true`
+ # @see example
+ define_example_method :pending, :pending => true
+
+ # @!endgroup
+
+ # @!group Defining Example Groups
+
+ # @private
+ # @macro [attach] define_example_group_method
+ # @!scope class
+ # @overload $1
+ # @overload $1(&example_group_definition)
+ # @param example_group_definition [Block] The definition of the example group.
+ # @overload $1(doc_string, *metadata_keys, metadata={}, &example_implementation)
+ # @param doc_string [String] The group's doc string.
+ # @param metadata [Hash] Metadata for the group.
+ # @param metadata_keys [Array] Metadata tags for the group.
+ # Will be transformed into hash entries with `true` values.
+ # @param example_group_definition [Block] The definition of the example group.
+ #
+ # Generates a subclass of this example group which inherits
+ # everything except the examples themselves.
+ #
+ # @example
+ #
+ # RSpec.describe "something" do # << This describe method is defined in
+ # # << RSpec::Core::DSL, included in the
+ # # << global namespace (optional)
+ # before do
+ # do_something_before
+ # end
+ #
+ # let(:thing) { Thing.new }
+ #
+ # $1 "attribute (of something)" do
+ # # examples in the group get the before hook
+ # # declared above, and can access `thing`
+ # end
+ # end
+ #
+ # @see DSL#describe
+ def self.define_example_group_method(name, metadata={})
+ idempotently_define_singleton_method(name) do |*args, &example_group_block|
+ thread_data = RSpec::Support.thread_local_data
+ top_level = self == ExampleGroup
+
+ if top_level
+ if thread_data[:in_example_group]
+ raise "Creating an isolated context from within a context is " \
+ "not allowed. Change `RSpec.#{name}` to `#{name}` or " \
+ "move this to a top-level scope."
+ end
+
+ thread_data[:in_example_group] = true
+ end
+
+ begin
+
+ description = args.shift
+ combined_metadata = metadata.dup
+ combined_metadata.merge!(args.pop) if args.last.is_a? Hash
+ args << combined_metadata
+
+ subclass(self, description, args, &example_group_block).tap do |child|
+ children << child
+ end
+
+ ensure
+ thread_data.delete(:in_example_group) if top_level
+ end
+ end
+
+ RSpec::Core::DSL.expose_example_group_alias(name)
+ end
+
+ define_example_group_method :example_group
+
+ # An alias of `example_group`. Generally used when grouping examples by a
+ # thing you are describing (e.g. an object, class or method).
+ # @see example_group
+ define_example_group_method :describe
+
+ # An alias of `example_group`. Generally used when grouping examples
+ # contextually (e.g. "with xyz", "when xyz" or "if xyz").
+ # @see example_group
+ define_example_group_method :context
+
+ # Shortcut to temporarily make an example group skipped.
+ # @see example_group
+ define_example_group_method :xdescribe, :skip => "Temporarily skipped with xdescribe"
+
+ # Shortcut to temporarily make an example group skipped.
+ # @see example_group
+ define_example_group_method :xcontext, :skip => "Temporarily skipped with xcontext"
+
+ # Shortcut to define an example group with `:focus => true`.
+ # @see example_group
+ define_example_group_method :fdescribe, :focus => true
+
+ # Shortcut to define an example group with `:focus => true`.
+ # @see example_group
+ define_example_group_method :fcontext, :focus => true
+
+ # @!endgroup
+
+ # @!group Including Shared Example Groups
+
+ # @private
+ # @macro [attach] define_nested_shared_group_method
+ # @!scope class
+ #
+ # @see SharedExampleGroup
+ def self.define_nested_shared_group_method(new_name, report_label="it should behave like")
+ idempotently_define_singleton_method(new_name) do |name, *args, &customization_block|
+ # Pass :caller so the :location metadata is set properly.
+ # Otherwise, it'll be set to the next line because that's
+ # the block's source_location.
+ group = example_group("#{report_label} #{name}", :caller => (the_caller = caller)) do
+ find_and_eval_shared("examples", name, the_caller.first, *args, &customization_block)
+ end
+ group.metadata[:shared_group_name] = name
+ group
+ end
+ end
+
+ # Generates a nested example group and includes the shared content
+ # mapped to `name` in the nested group.
+ define_nested_shared_group_method :it_behaves_like, "behaves like"
+ # Generates a nested example group and includes the shared content
+ # mapped to `name` in the nested group.
+ define_nested_shared_group_method :it_should_behave_like
+
+ # Includes shared content mapped to `name` directly in the group in which
+ # it is declared, as opposed to `it_behaves_like`, which creates a nested
+ # group. If given a block, that block is also eval'd in the current
+ # context.
+ #
+ # @see SharedExampleGroup
+ def self.include_context(name, *args, &block)
+ find_and_eval_shared("context", name, caller.first, *args, &block)
+ end
+
+ # Includes shared content mapped to `name` directly in the group in which
+ # it is declared, as opposed to `it_behaves_like`, which creates a nested
+ # group. If given a block, that block is also eval'd in the current
+ # context.
+ #
+ # @see SharedExampleGroup
+ def self.include_examples(name, *args, &block)
+ find_and_eval_shared("examples", name, caller.first, *args, &block)
+ end
+
+ # @private
+ def self.find_and_eval_shared(label, name, inclusion_location, *args, &customization_block)
+ shared_block = RSpec.world.shared_example_group_registry.find(parent_groups, name)
+
+ unless shared_block
+ raise ArgumentError, "Could not find shared #{label} #{name.inspect}"
+ end
+
+ SharedExampleGroupInclusionStackFrame.with_frame(name, Metadata.relative_path(inclusion_location)) do
+ module_exec(*args, &shared_block)
+ module_exec(&customization_block) if customization_block
+ end
+ end
+
+ # @!endgroup
+
+ # @private
+ def self.subclass(parent, description, args, &example_group_block)
+ subclass = Class.new(parent)
+ subclass.set_it_up(description, *args, &example_group_block)
+ subclass.module_exec(&example_group_block) if example_group_block
+
+ # The LetDefinitions module must be included _after_ other modules
+ # to ensure that it takes precedence when there are name collisions.
+ # Thus, we delay including it until after the example group block
+ # has been eval'd.
+ MemoizedHelpers.define_helpers_on(subclass)
+
+ subclass
+ end
+
+ # @private
+ def self.set_it_up(description, *args, &example_group_block)
+ # Ruby 1.9 has a bug that can lead to infinite recursion and a
+ # SystemStackError if you include a module in a superclass after
+ # including it in a subclass: https://gist.github.com/845896
+ # To prevent this, we must include any modules in
+ # RSpec::Core::ExampleGroup before users create example groups and have
+ # a chance to include the same module in a subclass of
+ # RSpec::Core::ExampleGroup. So we need to configure example groups
+ # here.
+ ensure_example_groups_are_configured
+
+ user_metadata = Metadata.build_hash_from(args)
+
+ @metadata = Metadata::ExampleGroupHash.create(
+ superclass_metadata, user_metadata,
+ superclass.method(:next_runnable_index_for),
+ description, *args, &example_group_block
+ )
+ ExampleGroups.assign_const(self)
+
+ hooks.register_globals(self, RSpec.configuration.hooks)
+ RSpec.configuration.configure_group(self)
+ end
+
+ # @private
+ def self.examples
+ @examples ||= []
+ end
+
+ # @private
+ def self.filtered_examples
+ RSpec.world.filtered_examples[self]
+ end
+
+ # @private
+ def self.descendant_filtered_examples
+ @descendant_filtered_examples ||= filtered_examples +
+ FlatMap.flat_map(children, &:descendant_filtered_examples)
+ end
+
+ # @private
+ def self.children
+ @children ||= []
+ end
+
+ # @private
+ def self.next_runnable_index_for(file)
+ if self == ExampleGroup
+ RSpec.world.num_example_groups_defined_in(file)
+ else
+ children.count + examples.count
+ end + 1
+ end
+
+ # @private
+ def self.descendants
+ @_descendants ||= [self] + FlatMap.flat_map(children, &:descendants)
+ end
+
+ ## @private
+ def self.parent_groups
+ @parent_groups ||= ancestors.select { |a| a < RSpec::Core::ExampleGroup }
+ end
+
+ # @private
+ def self.top_level?
+ superclass == ExampleGroup
+ end
+
+ # @private
+ def self.ensure_example_groups_are_configured
+ unless defined?(@@example_groups_configured)
+ RSpec.configuration.configure_mock_framework
+ RSpec.configuration.configure_expectation_framework
+ # rubocop:disable Style/ClassVars
+ @@example_groups_configured = true
+ # rubocop:enable Style/ClassVars
+ end
+ end
+
+ # @private
+ def self.before_context_ivars
+ @before_context_ivars ||= {}
+ end
+
+ # @private
+ def self.store_before_context_ivars(example_group_instance)
+ each_instance_variable_for_example(example_group_instance) do |ivar|
+ before_context_ivars[ivar] = example_group_instance.instance_variable_get(ivar)
+ end
+ end
+
+ # @private
+ def self.run_before_context_hooks(example_group_instance)
+ set_ivars(example_group_instance, superclass_before_context_ivars)
+
+ ContextHookMemoized::Before.isolate_for_context_hook(example_group_instance) do
+ hooks.run(:before, :context, example_group_instance)
+ end
+ ensure
+ store_before_context_ivars(example_group_instance)
+ end
+
+ if RUBY_VERSION.to_f >= 1.9
+ # @private
+ def self.superclass_before_context_ivars
+ superclass.before_context_ivars
+ end
+ else # 1.8.7
+ # :nocov:
+ # @private
+ def self.superclass_before_context_ivars
+ if superclass.respond_to?(:before_context_ivars)
+ superclass.before_context_ivars
+ else
+ # `self` must be the singleton class of an ExampleGroup instance.
+ # On 1.8.7, the superclass of a singleton class of an instance of A
+ # is A's singleton class. On 1.9+, it's A. On 1.8.7, the first ancestor
+ # is A, so we can mirror 1.8.7's behavior here. Note that we have to
+ # search for the first that responds to `before_context_ivars`
+ # in case a module has been included in the singleton class.
+ ancestors.find { |a| a.respond_to?(:before_context_ivars) }.before_context_ivars
+ end
+ end
+ # :nocov:
+ end
+
+ # @private
+ def self.run_after_context_hooks(example_group_instance)
+ set_ivars(example_group_instance, before_context_ivars)
+
+ ContextHookMemoized::After.isolate_for_context_hook(example_group_instance) do
+ hooks.run(:after, :context, example_group_instance)
+ end
+ ensure
+ before_context_ivars.clear
+ end
+
+ # Runs all the examples in this group.
+ def self.run(reporter=RSpec::Core::NullReporter)
+ return if RSpec.world.wants_to_quit
+ reporter.example_group_started(self)
+
+ should_run_context_hooks = descendant_filtered_examples.any?
+ begin
+ run_before_context_hooks(new('before(:context) hook')) if should_run_context_hooks
+ result_for_this_group = run_examples(reporter)
+ results_for_descendants = ordering_strategy.order(children).map { |child| child.run(reporter) }.all?
+ result_for_this_group && results_for_descendants
+ rescue Pending::SkipDeclaredInExample => ex
+ for_filtered_examples(reporter) { |example| example.skip_with_exception(reporter, ex) }
+ true
+ rescue Exception => ex
+ RSpec.world.wants_to_quit = true if fail_fast?
+ for_filtered_examples(reporter) { |example| example.fail_with_exception(reporter, ex) }
+ false
+ ensure
+ run_after_context_hooks(new('after(:context) hook')) if should_run_context_hooks
+ reporter.example_group_finished(self)
+ end
+ end
+
+ # @private
+ def self.ordering_strategy
+ order = metadata.fetch(:order, :global)
+ registry = RSpec.configuration.ordering_registry
+
+ registry.fetch(order) do
+ warn <<-WARNING.gsub(/^ +\|/, '')
+ |WARNING: Ignoring unknown ordering specified using `:order => #{order.inspect}` metadata.
+ | Falling back to configured global ordering.
+ | Unrecognized ordering specified at: #{location}
+ WARNING
+
+ registry.fetch(:global)
+ end
+ end
+
+ # @private
+ def self.run_examples(reporter)
+ ordering_strategy.order(filtered_examples).map do |example|
+ next if RSpec.world.wants_to_quit
+ instance = new(example.inspect_output)
+ set_ivars(instance, before_context_ivars)
+ succeeded = example.run(instance, reporter)
+ RSpec.world.wants_to_quit = true if fail_fast? && !succeeded
+ succeeded
+ end.all?
+ end
+
+ # @private
+ def self.for_filtered_examples(reporter, &block)
+ filtered_examples.each(&block)
+
+ children.each do |child|
+ reporter.example_group_started(child)
+ child.for_filtered_examples(reporter, &block)
+ reporter.example_group_finished(child)
+ end
+ false
+ end
+
+ # @private
+ def self.fail_fast?
+ RSpec.configuration.fail_fast?
+ end
+
+ # @private
+ def self.declaration_line_numbers
+ @declaration_line_numbers ||= [metadata[:line_number]] +
+ examples.map { |e| e.metadata[:line_number] } +
+ FlatMap.flat_map(children, &:declaration_line_numbers)
+ end
+
+ # @return [String] the unique id of this example group. Pass
+ # this at the command line to re-run this exact example group.
+ def self.id
+ Metadata.id_from(metadata)
+ end
+
+ # @private
+ def self.top_level_description
+ parent_groups.last.description
+ end
+
+ # @private
+ def self.set_ivars(instance, ivars)
+ ivars.each { |name, value| instance.instance_variable_set(name, value) }
+ end
+
+ if RUBY_VERSION.to_f < 1.9
+ # :nocov:
+ # @private
+ INSTANCE_VARIABLE_TO_IGNORE = '@__inspect_output'.freeze
+ # :nocov:
+ else
+ # @private
+ INSTANCE_VARIABLE_TO_IGNORE = :@__inspect_output
+ end
+
+ # @private
+ def self.each_instance_variable_for_example(group)
+ group.instance_variables.each do |ivar|
+ yield ivar unless ivar == INSTANCE_VARIABLE_TO_IGNORE
+ end
+ end
+
+ def initialize(inspect_output=nil)
+ @__inspect_output = inspect_output || '(no description provided)'
+ super() # no args get passed
+ end
+
+ # @private
+ def inspect
+ "#<#{self.class} #{@__inspect_output}>"
+ end
+
+ unless method_defined?(:singleton_class) # for 1.8.7
+ # :nocov:
+ # @private
+ def singleton_class
+ class << self; self; end
+ end
+ # :nocov:
+ end
+
+ # Raised when an RSpec API is called in the wrong scope, such as `before`
+ # being called from within an example rather than from within an example
+ # group block.
+ WrongScopeError = Class.new(NoMethodError)
+
+ def self.method_missing(name, *args)
+ if method_defined?(name)
+ raise WrongScopeError,
+ "`#{name}` is not available on an example group (e.g. a " \
+ "`describe` or `context` block). It is only available from " \
+ "within individual examples (e.g. `it` blocks) or from " \
+ "constructs that run in the scope of an example (e.g. " \
+ "`before`, `let`, etc)."
+ end
+
+ super
+ end
+ private_class_method :method_missing
+
+ private
+
+ def method_missing(name, *args)
+ if self.class.respond_to?(name)
+ raise WrongScopeError,
+ "`#{name}` is not available from within an example (e.g. an " \
+ "`it` block) or from constructs that run in the scope of an " \
+ "example (e.g. `before`, `let`, etc). It is only available " \
+ "on an example group (e.g. a `describe` or `context` block)."
+ end
+
+ super
+ end
+ end
+
+ # @private
+ # Unnamed example group used by `SuiteHookContext`.
+ class AnonymousExampleGroup < ExampleGroup
+ def self.metadata
+ {}
+ end
+ end
+
+ # Contains information about the inclusion site of a shared example group.
+ class SharedExampleGroupInclusionStackFrame
+ # @return [String] the name of the shared example group
+ attr_reader :shared_group_name
+ # @return [String] the location where the shared example was included
+ attr_reader :inclusion_location
+
+ def initialize(shared_group_name, inclusion_location)
+ @shared_group_name = shared_group_name
+ @inclusion_location = inclusion_location
+ end
+
+ # @return [String] The {#inclusion_location}, formatted for display by a formatter.
+ def formatted_inclusion_location
+ @formatted_inclusion_location ||= begin
+ RSpec.configuration.backtrace_formatter.backtrace_line(
+ inclusion_location.sub(/(:\d+):in .+$/, '\1')
+ )
+ end
+ end
+
+ # @return [String] Description of this stack frame, in the form used by
+ # RSpec's built-in formatters.
+ def description
+ @description ||= "Shared Example Group: #{shared_group_name.inspect} " \
+ "called from #{formatted_inclusion_location}"
+ end
+
+ # @private
+ def self.current_backtrace
+ shared_example_group_inclusions.reverse
+ end
+
+ # @private
+ def self.with_frame(name, location)
+ current_stack = shared_example_group_inclusions
+ current_stack << new(name, location)
+ yield
+ ensure
+ current_stack.pop
+ end
+
+ # @private
+ def self.shared_example_group_inclusions
+ RSpec::Support.thread_local_data[:shared_example_group_inclusions] ||= []
+ end
+ end
+ end
+
+ # @private
+ #
+ # Namespace for the example group subclasses generated by top-level
+ # `describe`.
+ module ExampleGroups
+ extend Support::RecursiveConstMethods
+
+ def self.assign_const(group)
+ base_name = base_name_for(group)
+ const_scope = constant_scope_for(group)
+ name = disambiguate(base_name, const_scope)
+
+ const_scope.const_set(name, group)
+ end
+
+ def self.constant_scope_for(group)
+ const_scope = group.superclass
+ const_scope = self if const_scope == ::RSpec::Core::ExampleGroup
+ const_scope
+ end
+
+ def self.base_name_for(group)
+ return "Anonymous" if group.description.empty?
+
+ # Convert to CamelCase.
+ name = ' ' << group.description
+ name.gsub!(/[^0-9a-zA-Z]+([0-9a-zA-Z])/) do
+ match = ::Regexp.last_match[1]
+ match.upcase!
+ match
+ end
+
+ name.lstrip! # Remove leading whitespace
+ name.gsub!(/\W/, ''.freeze) # JRuby, RBX and others don't like non-ascii in const names
+
+ # Ruby requires first const letter to be A-Z. Use `Nested`
+ # as necessary to enforce that.
+ name.gsub!(/\A([^A-Z]|\z)/, 'Nested\1'.freeze)
+
+ name
+ end
+
+ if RUBY_VERSION == '1.9.2'
+ # :nocov:
+ class << self
+ alias _base_name_for base_name_for
+ def base_name_for(group)
+ _base_name_for(group) + '_'
+ end
+ end
+ private_class_method :_base_name_for
+ # :nocov:
+ end
+
+ def self.disambiguate(name, const_scope)
+ return name unless const_defined_on?(const_scope, name)
+
+ # Add a trailing number if needed to disambiguate from an existing
+ # constant.
+ name << "_2"
+ name.next! while const_defined_on?(const_scope, name)
+ name
+ end
+ end
+end
diff --git a/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/example_status_persister.rb b/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/example_status_persister.rb
new file mode 100644
index 0000000..0eb8a0a
--- /dev/null
+++ b/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/example_status_persister.rb
@@ -0,0 +1,235 @@
+RSpec::Support.require_rspec_support "directory_maker"
+
+module RSpec
+ module Core
+ # Persists example ids and their statuses so that we can filter
+ # to just the ones that failed the last time they ran.
+ # @private
+ class ExampleStatusPersister
+ def self.load_from(file_name)
+ return [] unless File.exist?(file_name)
+ ExampleStatusParser.parse(File.read(file_name))
+ end
+
+ def self.persist(examples, file_name)
+ new(examples, file_name).persist
+ end
+
+ def initialize(examples, file_name)
+ @examples = examples
+ @file_name = file_name
+ end
+
+ def persist
+ write dumped_statuses
+ end
+
+ private
+
+ def write(statuses)
+ RSpec::Support::DirectoryMaker.mkdir_p(File.dirname(@file_name))
+ File.open(@file_name, "w") { |f| f.write(statuses) }
+ end
+
+ def dumped_statuses
+ ExampleStatusDumper.dump(merged_statuses)
+ end
+
+ def merged_statuses
+ ExampleStatusMerger.merge(statuses_from_this_run, statuses_from_previous_runs)
+ end
+
+ def statuses_from_this_run
+ @examples.map do |ex|
+ result = ex.execution_result
+
+ {
+ :example_id => ex.id,
+ :status => result.status ? result.status.to_s : Configuration::UNKNOWN_STATUS,
+ :run_time => result.run_time ? Formatters::Helpers.format_duration(result.run_time) : ""
+ }
+ end
+ end
+
+ def statuses_from_previous_runs
+ self.class.load_from(@file_name)
+ end
+ end
+
+ # Merges together a list of example statuses from this run
+ # and a list from previous runs (presumably loaded from disk).
+ # Each example status object is expected to be a hash with
+ # at least an `:example_id` and a `:status` key. Examples that
+ # were loaded but not executed (due to filtering, `--fail-fast`
+ # or whatever) should have a `:status` of `UNKNOWN_STATUS`.
+ #
+ # This willl produce a new list that:
+ # - Will be missing examples from previous runs that we know for sure
+ # no longer exist.
+ # - Will have the latest known status for any examples that either
+ # definitively do exist or may still exist.
+ # - Is sorted by file name and example definition order, so that
+ # the saved file is easily scannable if users want to inspect it.
+ # @private
+ class ExampleStatusMerger
+ def self.merge(this_run, from_previous_runs)
+ new(this_run, from_previous_runs).merge
+ end
+
+ def initialize(this_run, from_previous_runs)
+ @this_run = hash_from(this_run)
+ @from_previous_runs = hash_from(from_previous_runs)
+ @file_exists_cache = Hash.new { |hash, file| hash[file] = File.exist?(file) }
+ end
+
+ def merge
+ delete_previous_examples_that_no_longer_exist
+
+ @this_run.merge(@from_previous_runs) do |_ex_id, new, old|
+ new.fetch(:status) == Configuration::UNKNOWN_STATUS ? old : new
+ end.values.sort_by(&method(:sort_value_from))
+ end
+
+ private
+
+ def hash_from(example_list)
+ example_list.inject({}) do |hash, example|
+ hash[example.fetch(:example_id)] = example
+ hash
+ end
+ end
+
+ def delete_previous_examples_that_no_longer_exist
+ @from_previous_runs.delete_if do |ex_id, _|
+ example_must_no_longer_exist?(ex_id)
+ end
+ end
+
+ def example_must_no_longer_exist?(ex_id)
+ # Obviously, it exists if it was loaded for this spec run...
+ return false if @this_run.key?(ex_id)
+
+ spec_file = spec_file_from(ex_id)
+
+ # `this_run` includes examples that were loaded but not executed.
+ # Given that, if the spec file for this example was loaded,
+ # but the id does not still exist, it's safe to assume that
+ # the example must no longer exist.
+ return true if loaded_spec_files.include?(spec_file)
+
+ # The example may still exist as long as the file exists...
+ !@file_exists_cache[spec_file]
+ end
+
+ def loaded_spec_files
+ @loaded_spec_files ||= Set.new(@this_run.keys.map(&method(:spec_file_from)))
+ end
+
+ def spec_file_from(ex_id)
+ ex_id.split("[").first
+ end
+
+ def sort_value_from(example)
+ file, scoped_id = example.fetch(:example_id).split(Configuration::ON_SQUARE_BRACKETS)
+ [file, *scoped_id.split(":").map(&method(:Integer))]
+ end
+ end
+
+ # Dumps a list of hashes in a pretty, human readable format
+ # for later parsing. The hashes are expected to have symbol
+ # keys and string values, and each hash should have the same
+ # set of keys.
+ # @private
+ class ExampleStatusDumper
+ def self.dump(examples)
+ new(examples).dump
+ end
+
+ def initialize(examples)
+ @examples = examples
+ end
+
+ def dump
+ return nil if @examples.empty?
+ (formatted_header_rows + formatted_value_rows).join("\n") << "\n"
+ end
+
+ private
+
+ def formatted_header_rows
+ @formatted_header_rows ||= begin
+ dividers = column_widths.map { |w| "-" * w }
+ [formatted_row_from(headers.map(&:to_s)), formatted_row_from(dividers)]
+ end
+ end
+
+ def formatted_value_rows
+ @foramtted_value_rows ||= rows.map do |row|
+ formatted_row_from(row)
+ end
+ end
+
+ def rows
+ @rows ||= @examples.map { |ex| ex.values_at(*headers) }
+ end
+
+ def formatted_row_from(row_values)
+ padded_values = row_values.each_with_index.map do |value, index|
+ value.ljust(column_widths[index])
+ end
+
+ padded_values.join(" | ") << " |"
+ end
+
+ def headers
+ @headers ||= @examples.first.keys
+ end
+
+ def column_widths
+ @column_widths ||= begin
+ value_sets = rows.transpose
+
+ headers.each_with_index.map do |header, index|
+ values = value_sets[index] << header.to_s
+ values.map(&:length).max
+ end
+ end
+ end
+ end
+
+ # Parses a string that has been previously dumped by ExampleStatusDumper.
+ # Note that this parser is a bit naive in that it does a simple split on
+ # "\n" and " | ", with no concern for handling escaping. For now, that's
+ # OK because the values we plan to persist (example id, status, and perhaps
+ # example duration) are highly unlikely to contain "\n" or " | " -- after
+ # all, who puts those in file names?
+ # @private
+ class ExampleStatusParser
+ def self.parse(string)
+ new(string).parse
+ end
+
+ def initialize(string)
+ @header_line, _, *@row_lines = string.lines.to_a
+ end
+
+ def parse
+ @row_lines.map { |line| parse_row(line) }
+ end
+
+ private
+
+ def parse_row(line)
+ Hash[headers.zip(split_line(line))]
+ end
+
+ def headers
+ @headers ||= split_line(@header_line).grep(/\S/).map(&:to_sym)
+ end
+
+ def split_line(line)
+ line.split(/\s+\|\s+?/, -1)
+ end
+ end
+ end
+end
diff --git a/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/filter_manager.rb b/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/filter_manager.rb
new file mode 100644
index 0000000..e5e062a
--- /dev/null
+++ b/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/filter_manager.rb
@@ -0,0 +1,231 @@
+module RSpec
+ module Core
+ # @private
+ class FilterManager
+ attr_reader :exclusions, :inclusions
+
+ def initialize
+ @exclusions, @inclusions = FilterRules.build
+ end
+
+ # @api private
+ #
+ # @param file_path [String]
+ # @param line_numbers [Array]
+ def add_location(file_path, line_numbers)
+ # locations is a hash of expanded paths to arrays of line
+ # numbers to match against. e.g.
+ # { "path/to/file.rb" => [37, 42] }
+ add_path_to_arrays_filter(:locations, File.expand_path(file_path), line_numbers)
+ end
+
+ def add_ids(rerun_path, scoped_ids)
+ # ids is a hash of relative paths to arrays of ids
+ # to match against. e.g.
+ # { "./path/to/file.rb" => ["1:1", "2:4"] }
+ rerun_path = Metadata.relative_path(File.expand_path rerun_path)
+ add_path_to_arrays_filter(:ids, rerun_path, scoped_ids)
+ end
+
+ def empty?
+ inclusions.empty? && exclusions.empty?
+ end
+
+ def prune(examples)
+ # Semantically, this is unnecessary (the filtering below will return the empty
+ # array unmodified), but for perf reasons it's worth exiting early here. Users
+ # commonly have top-level examples groups that do not have any direct examples
+ # and instead have nested groups with examples. In that kind of situation,
+ # `examples` will be empty.
+ return examples if examples.empty?
+
+ examples = prune_conditionally_filtered_examples(examples)
+
+ if inclusions.standalone?
+ examples.select { |e| inclusions.include_example?(e) }
+ else
+ locations, ids, non_scoped_inclusions = inclusions.split_file_scoped_rules
+
+ examples.select do |ex|
+ file_scoped_include?(ex.metadata, ids, locations) do
+ !exclusions.include_example?(ex) && non_scoped_inclusions.include_example?(ex)
+ end
+ end
+ end
+ end
+
+ def exclude(*args)
+ exclusions.add(args.last)
+ end
+
+ def exclude_only(*args)
+ exclusions.use_only(args.last)
+ end
+
+ def exclude_with_low_priority(*args)
+ exclusions.add_with_low_priority(args.last)
+ end
+
+ def include(*args)
+ inclusions.add(args.last)
+ end
+
+ def include_only(*args)
+ inclusions.use_only(args.last)
+ end
+
+ def include_with_low_priority(*args)
+ inclusions.add_with_low_priority(args.last)
+ end
+
+ private
+
+ def add_path_to_arrays_filter(filter_key, path, values)
+ filter = inclusions.delete(filter_key) || Hash.new { |h, k| h[k] = [] }
+ filter[path].concat(values)
+ inclusions.add(filter_key => filter)
+ end
+
+ def prune_conditionally_filtered_examples(examples)
+ examples.reject do |ex|
+ meta = ex.metadata
+ !meta.fetch(:if, true) || meta[:unless]
+ end
+ end
+
+ # When a user specifies a particular spec location, that takes priority
+ # over any exclusion filters (such as if the spec is tagged with `:slow`
+ # and there is a `:slow => true` exclusion filter), but only for specs
+ # defined in the same file as the location filters. Excluded specs in
+ # other files should still be excluded.
+ def file_scoped_include?(ex_metadata, ids, locations)
+ no_id_filters = ids[ex_metadata[:rerun_file_path]].empty?
+ no_location_filters = locations[
+ File.expand_path(ex_metadata[:rerun_file_path])
+ ].empty?
+
+ return yield if no_location_filters && no_id_filters
+
+ MetadataFilter.filter_applies?(:ids, ids, ex_metadata) ||
+ MetadataFilter.filter_applies?(:locations, locations, ex_metadata)
+ end
+ end
+
+ # @private
+ class FilterRules
+ PROC_HEX_NUMBER = /0x[0-9a-f]+@/
+ PROJECT_DIR = File.expand_path('.')
+
+ attr_accessor :opposite
+ attr_reader :rules
+
+ def self.build
+ exclusions = ExclusionRules.new
+ inclusions = InclusionRules.new
+ exclusions.opposite = inclusions
+ inclusions.opposite = exclusions
+ [exclusions, inclusions]
+ end
+
+ def initialize(rules={})
+ @rules = rules
+ end
+
+ def add(updated)
+ @rules.merge!(updated).each_key { |k| opposite.delete(k) }
+ end
+
+ def add_with_low_priority(updated)
+ updated = updated.merge(@rules)
+ opposite.each_pair { |k, v| updated.delete(k) if updated[k] == v }
+ @rules.replace(updated)
+ end
+
+ def use_only(updated)
+ updated.each_key { |k| opposite.delete(k) }
+ @rules.replace(updated)
+ end
+
+ def clear
+ @rules.clear
+ end
+
+ def delete(key)
+ @rules.delete(key)
+ end
+
+ def fetch(*args, &block)
+ @rules.fetch(*args, &block)
+ end
+
+ def [](key)
+ @rules[key]
+ end
+
+ def empty?
+ rules.empty?
+ end
+
+ def each_pair(&block)
+ @rules.each_pair(&block)
+ end
+
+ def description
+ rules.inspect.gsub(PROC_HEX_NUMBER, '').gsub(PROJECT_DIR, '.').gsub(' (lambda)', '')
+ end
+
+ def include_example?(example)
+ MetadataFilter.apply?(:any?, @rules, example.metadata)
+ end
+ end
+
+ # @private
+ ExclusionRules = FilterRules
+
+ # @private
+ class InclusionRules < FilterRules
+ def add(*args)
+ apply_standalone_filter(*args) || super
+ end
+
+ def add_with_low_priority(*args)
+ apply_standalone_filter(*args) || super
+ end
+
+ def include_example?(example)
+ @rules.empty? || super
+ end
+
+ def standalone?
+ is_standalone_filter?(@rules)
+ end
+
+ def split_file_scoped_rules
+ rules_dup = @rules.dup
+ locations = rules_dup.delete(:locations) { Hash.new([]) }
+ ids = rules_dup.delete(:ids) { Hash.new([]) }
+
+ return locations, ids, self.class.new(rules_dup)
+ end
+
+ private
+
+ def apply_standalone_filter(updated)
+ return true if standalone?
+ return nil unless is_standalone_filter?(updated)
+
+ replace_filters(updated)
+ true
+ end
+
+ def replace_filters(new_rules)
+ @rules.replace(new_rules)
+ opposite.clear
+ end
+
+ def is_standalone_filter?(rules)
+ rules.key?(:full_description)
+ end
+ end
+ end
+end
diff --git a/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/flat_map.rb b/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/flat_map.rb
new file mode 100644
index 0000000..0e30cce
--- /dev/null
+++ b/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/flat_map.rb
@@ -0,0 +1,20 @@
+module RSpec
+ module Core
+ # @private
+ module FlatMap
+ if [].respond_to?(:flat_map)
+ def flat_map(array, &block)
+ array.flat_map(&block)
+ end
+ else # for 1.8.7
+ # :nocov:
+ def flat_map(array, &block)
+ array.map(&block).flatten(1)
+ end
+ # :nocov:
+ end
+
+ module_function :flat_map
+ end
+ end
+end
diff --git a/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/formatters.rb b/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/formatters.rb
new file mode 100644
index 0000000..401e2d8
--- /dev/null
+++ b/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/formatters.rb
@@ -0,0 +1,254 @@
+RSpec::Support.require_rspec_support "directory_maker"
+# ## Built-in Formatters
+#
+# * progress (default) - Prints dots for passing examples, `F` for failures, `*`
+# for pending.
+# * documentation - Prints the docstrings passed to `describe` and `it` methods
+# (and their aliases).
+# * html
+# * json - Useful for archiving data for subsequent analysis.
+#
+# The progress formatter is the default, but you can choose any one or more of
+# the other formatters by passing with the `--format` (or `-f` for short)
+# command-line option, e.g.
+#
+# rspec --format documentation
+#
+# You can also send the output of multiple formatters to different streams, e.g.
+#
+# rspec --format documentation --format html --out results.html
+#
+# This example sends the output of the documentation formatter to `$stdout`, and
+# the output of the html formatter to results.html.
+#
+# ## Custom Formatters
+#
+# You can tell RSpec to use a custom formatter by passing its path and name to
+# the `rspec` commmand. For example, if you define MyCustomFormatter in
+# path/to/my_custom_formatter.rb, you would type this command:
+#
+# rspec --require path/to/my_custom_formatter.rb --format MyCustomFormatter
+#
+# The reporter calls every formatter with this protocol:
+#
+# * To start
+# * `start(StartNotification)`
+# * Once per example group
+# * `example_group_started(GroupNotification)`
+# * Once per example
+# * `example_started(ExampleNotification)`
+# * One of these per example, depending on outcome
+# * `example_passed(ExampleNotification)`
+# * `example_failed(FailedExampleNotification)`
+# * `example_pending(ExampleNotification)`
+# * Optionally at any time
+# * `message(MessageNotification)`
+# * At the end of the suite
+# * `stop(ExamplesNotification)`
+# * `start_dump(NullNotification)`
+# * `dump_pending(ExamplesNotification)`
+# * `dump_failures(ExamplesNotification)`
+# * `dump_summary(SummaryNotification)`
+# * `seed(SeedNotification)`
+# * `close(NullNotification)`
+#
+# Only the notifications to which you subscribe your formatter will be called
+# on your formatter. To subscribe your formatter use:
+# `RSpec::Core::Formatters#register` e.g.
+#
+# `RSpec::Core::Formatters.register FormatterClassName, :example_passed, :example_failed`
+#
+# We recommend you implement the methods yourself; for simplicity we provide the
+# default formatter output via our notification objects but if you prefer you
+# can subclass `RSpec::Core::Formatters::BaseTextFormatter` and override the
+# methods you wish to enhance.
+#
+# @see RSpec::Core::Formatters::BaseTextFormatter
+# @see RSpec::Core::Reporter
+module RSpec::Core::Formatters
+ autoload :DocumentationFormatter, 'rspec/core/formatters/documentation_formatter'
+ autoload :HtmlFormatter, 'rspec/core/formatters/html_formatter'
+ autoload :FallbackMessageFormatter, 'rspec/core/formatters/fallback_message_formatter'
+ autoload :ProgressFormatter, 'rspec/core/formatters/progress_formatter'
+ autoload :ProfileFormatter, 'rspec/core/formatters/profile_formatter'
+ autoload :JsonFormatter, 'rspec/core/formatters/json_formatter'
+ autoload :BisectFormatter, 'rspec/core/formatters/bisect_formatter'
+
+ # Register the formatter class
+ # @param formatter_class [Class] formatter class to register
+ # @param notifications [Symbol, ...] one or more notifications to be
+ # registered to the specified formatter
+ #
+ # @see RSpec::Core::Formatters::BaseFormatter
+ def self.register(formatter_class, *notifications)
+ Loader.formatters[formatter_class] = notifications
+ end
+
+ # @api private
+ #
+ # `RSpec::Core::Formatters::Loader` is an internal class for
+ # managing formatters used by a particular configuration. It is
+ # not expected to be used directly, but only through the configuration
+ # interface.
+ class Loader
+ # @api private
+ #
+ # Internal formatters are stored here when loaded.
+ def self.formatters
+ @formatters ||= {}
+ end
+
+ # @api private
+ def initialize(reporter)
+ @formatters = []
+ @reporter = reporter
+ self.default_formatter = 'progress'
+ end
+
+ # @return [Array] the loaded formatters
+ attr_reader :formatters
+
+ # @return [Reporter] the reporter
+ attr_reader :reporter
+
+ # @return [String] the default formatter to setup, defaults to `progress`
+ attr_accessor :default_formatter
+
+ # @private
+ def setup_default(output_stream, deprecation_stream)
+ add default_formatter, output_stream if @formatters.empty?
+
+ unless @formatters.any? { |formatter| DeprecationFormatter === formatter }
+ add DeprecationFormatter, deprecation_stream, output_stream
+ end
+
+ unless existing_formatter_implements?(:message)
+ add FallbackMessageFormatter, output_stream
+ end
+
+ return unless RSpec.configuration.profile_examples?
+
+ @reporter.setup_profiler
+
+ return if existing_formatter_implements?(:dump_profile)
+
+ add RSpec::Core::Formatters::ProfileFormatter, output_stream
+ end
+
+ # @private
+ def add(formatter_to_use, *paths)
+ formatter_class = find_formatter(formatter_to_use)
+
+ args = paths.map { |p| p.respond_to?(:puts) ? p : file_at(p) }
+
+ if !Loader.formatters[formatter_class].nil?
+ formatter = formatter_class.new(*args)
+ register formatter, notifications_for(formatter_class)
+ elsif defined?(RSpec::LegacyFormatters)
+ formatter = RSpec::LegacyFormatters.load_formatter formatter_class, *args
+ register formatter, formatter.notifications
+ else
+ call_site = "Formatter added at: #{::RSpec::CallerFilter.first_non_rspec_line}"
+
+ RSpec.warn_deprecation <<-WARNING.gsub(/\s*\|/, ' ')
+ |The #{formatter_class} formatter uses the deprecated formatter
+ |interface not supported directly by RSpec 3.
+ |
+ |To continue to use this formatter you must install the
+ |`rspec-legacy_formatters` gem, which provides support
+ |for legacy formatters or upgrade the formatter to a
+ |compatible version.
+ |
+ |#{call_site}
+ WARNING
+ end
+ end
+
+ private
+
+ def find_formatter(formatter_to_use)
+ built_in_formatter(formatter_to_use) ||
+ custom_formatter(formatter_to_use) ||
+ (raise ArgumentError, "Formatter '#{formatter_to_use}' unknown - " \
+ "maybe you meant 'documentation' or 'progress'?.")
+ end
+
+ def register(formatter, notifications)
+ return if duplicate_formatter_exists?(formatter)
+ @reporter.register_listener formatter, *notifications
+ @formatters << formatter
+ formatter
+ end
+
+ def duplicate_formatter_exists?(new_formatter)
+ @formatters.any? do |formatter|
+ formatter.class == new_formatter.class && formatter.output == new_formatter.output
+ end
+ end
+
+ def existing_formatter_implements?(notification)
+ @reporter.registered_listeners(notification).any?
+ end
+
+ def built_in_formatter(key)
+ case key.to_s
+ when 'd', 'doc', 'documentation'
+ DocumentationFormatter
+ when 'h', 'html'
+ HtmlFormatter
+ when 'p', 'progress'
+ ProgressFormatter
+ when 'j', 'json'
+ JsonFormatter
+ when 'bisect'
+ BisectFormatter
+ end
+ end
+
+ def notifications_for(formatter_class)
+ formatter_class.ancestors.inject(::RSpec::Core::Set.new) do |notifications, klass|
+ notifications.merge Loader.formatters.fetch(klass) { ::RSpec::Core::Set.new }
+ end
+ end
+
+ def custom_formatter(formatter_ref)
+ if Class === formatter_ref
+ formatter_ref
+ elsif string_const?(formatter_ref)
+ begin
+ formatter_ref.gsub(/^::/, '').split('::').inject(Object) { |a, e| a.const_get e }
+ rescue NameError
+ require(path_for(formatter_ref)) ? retry : raise
+ end
+ end
+ end
+
+ def string_const?(str)
+ str.is_a?(String) && /\A[A-Z][a-zA-Z0-9_:]*\z/ =~ str
+ end
+
+ def path_for(const_ref)
+ underscore_with_fix_for_non_standard_rspec_naming(const_ref)
+ end
+
+ def underscore_with_fix_for_non_standard_rspec_naming(string)
+ underscore(string).sub(%r{(^|/)r_spec($|/)}, '\\1rspec\\2')
+ end
+
+ # activesupport/lib/active_support/inflector/methods.rb, line 48
+ def underscore(camel_cased_word)
+ word = camel_cased_word.to_s.dup
+ word.gsub!(/::/, '/')
+ word.gsub!(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
+ word.gsub!(/([a-z\d])([A-Z])/, '\1_\2')
+ word.tr!("-", "_")
+ word.downcase!
+ word
+ end
+
+ def file_at(path)
+ RSpec::Support::DirectoryMaker.mkdir_p(File.dirname(path))
+ File.new(path, 'w')
+ end
+ end
+end
diff --git a/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/formatters/base_formatter.rb b/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/formatters/base_formatter.rb
new file mode 100644
index 0000000..84248aa
--- /dev/null
+++ b/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/formatters/base_formatter.rb
@@ -0,0 +1,70 @@
+RSpec::Support.require_rspec_core "formatters/helpers"
+require 'stringio'
+
+module RSpec
+ module Core
+ module Formatters
+ # RSpec's built-in formatters are all subclasses of
+ # RSpec::Core::Formatters::BaseTextFormatter.
+ #
+ # @see RSpec::Core::Formatters::BaseTextFormatter
+ # @see RSpec::Core::Reporter
+ # @see RSpec::Core::Formatters::Protocol
+ class BaseFormatter
+ # All formatters inheriting from this formatter will receive these
+ # notifications.
+ Formatters.register self, :start, :example_group_started, :close
+ attr_accessor :example_group
+ attr_reader :output
+
+ # @api public
+ # @param output [IO] the formatter output
+ # @see RSpec::Core::Formatters::Protocol#initialize
+ def initialize(output)
+ @output = output || StringIO.new
+ @example_group = nil
+ end
+
+ # @api public
+ #
+ # @param notification [StartNotification]
+ # @see RSpec::Core::Formatters::Protocol#start
+ def start(notification)
+ start_sync_output
+ @example_count = notification.count
+ end
+
+ # @api public
+ #
+ # @param notification [GroupNotification] containing example_group
+ # subclass of `RSpec::Core::ExampleGroup`
+ # @see RSpec::Core::Formatters::Protocol#example_group_started
+ def example_group_started(notification)
+ @example_group = notification.group
+ end
+
+ # @api public
+ #
+ # @param _notification [NullNotification] (Ignored)
+ # @see RSpec::Core::Formatters::Protocol#close
+ def close(_notification)
+ restore_sync_output
+ end
+
+ private
+
+ def start_sync_output
+ @old_sync, output.sync = output.sync, true if output_supports_sync
+ end
+
+ def restore_sync_output
+ output.sync = @old_sync if output_supports_sync && !output.closed?
+ end
+
+ def output_supports_sync
+ output.respond_to?(:sync=)
+ end
+ end
+ end
+ end
+end
diff --git a/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/formatters/base_text_formatter.rb b/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/formatters/base_text_formatter.rb
new file mode 100644
index 0000000..262a8d3
--- /dev/null
+++ b/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/formatters/base_text_formatter.rb
@@ -0,0 +1,77 @@
+RSpec::Support.require_rspec_core "formatters/base_formatter"
+RSpec::Support.require_rspec_core "formatters/console_codes"
+
+module RSpec
+ module Core
+ module Formatters
+ # Base for all of RSpec's built-in formatters. See
+ # RSpec::Core::Formatters::BaseFormatter to learn more about all of the
+ # methods called by the reporter.
+ #
+ # @see RSpec::Core::Formatters::BaseFormatter
+ # @see RSpec::Core::Reporter
+ class BaseTextFormatter < BaseFormatter
+ Formatters.register self,
+ :message, :dump_summary, :dump_failures, :dump_pending, :seed
+
+ # @api public
+ #
+ # Used by the reporter to send messages to the output stream.
+ #
+ # @param notification [MessageNotification] containing message
+ def message(notification)
+ output.puts notification.message
+ end
+
+ # @api public
+ #
+ # Dumps detailed information about each example failure.
+ #
+ # @param notification [NullNotification]
+ def dump_failures(notification)
+ return if notification.failure_notifications.empty?
+ output.puts notification.fully_formatted_failed_examples
+ end
+
+ # @api public
+ #
+ # This method is invoked after the dumping of examples and failures.
+ # Each parameter is assigned to a corresponding attribute.
+ #
+ # @param summary [SummaryNotification] containing duration,
+ # example_count, failure_count and pending_count
+ def dump_summary(summary)
+ output.puts summary.fully_formatted
+ end
+
+ # @private
+ def dump_pending(notification)
+ return if notification.pending_examples.empty?
+ output.puts notification.fully_formatted_pending_examples
+ end
+
+ # @private
+ def seed(notification)
+ return unless notification.seed_used?
+ output.puts notification.fully_formatted
+ end
+
+ # @api public
+ #
+ # Invoked at the very end, `close` allows the formatter to clean
+ # up resources, e.g. open streams, etc.
+ #
+ # @param _notification [NullNotification] (Ignored)
+ def close(_notification)
+ return unless IO === output
+ return if output.closed?
+
+ output.puts
+
+ output.flush
+ output.close unless output == $stdout
+ end
+ end
+ end
+ end
+end
diff --git a/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/formatters/bisect_formatter.rb b/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/formatters/bisect_formatter.rb
new file mode 100644
index 0000000..60d8678
--- /dev/null
+++ b/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/formatters/bisect_formatter.rb
@@ -0,0 +1,68 @@
+require 'drb/drb'
+
+module RSpec
+ module Core
+ module Formatters
+ # Used by `--bisect`. When it shells out and runs a portion of the suite, it uses
+ # this formatter as a means to have the status reported back to it, via DRb.
+ #
+ # Note that since DRb calls carry considerable overhead compared to normal
+ # method calls, we try to minimize the number of DRb calls for perf reasons,
+ # opting to communicate only at the start and the end of the run, rather than
+ # after each example.
+ # @private
+ class BisectFormatter
+ Formatters.register self, :start, :start_dump, :example_started,
+ :example_failed, :example_passed, :example_pending
+
+ def initialize(_output)
+ port = RSpec.configuration.drb_port
+ drb_uri = "druby://localhost:#{port}"
+ @all_example_ids = []
+ @failed_example_ids = []
+ @bisect_server = DRbObject.new_with_uri(drb_uri)
+ @remaining_failures = []
+ end
+
+ def start(_notification)
+ @remaining_failures = Set.new(@bisect_server.expected_failures)
+ end
+
+ def example_started(notification)
+ @all_example_ids << notification.example.id
+ end
+
+ def example_failed(notification)
+ @failed_example_ids << notification.example.id
+ example_finished(notification, :failed)
+ end
+
+ def example_passed(notification)
+ example_finished(notification, :passed)
+ end
+
+ def example_pending(notification)
+ example_finished(notification, :pending)
+ end
+
+ def start_dump(_notification)
+ @bisect_server.latest_run_results = RunResults.new(
+ @all_example_ids, @failed_example_ids
+ )
+ end
+
+ RunResults = Struct.new(:all_example_ids, :failed_example_ids)
+
+ private
+
+ def example_finished(notification, status)
+ return unless @remaining_failures.include?(notification.example.id)
+ @remaining_failures.delete(notification.example.id)
+
+ return if status == :failed && !@remaining_failures.empty?
+ RSpec.world.wants_to_quit = true
+ end
+ end
+ end
+ end
+end
diff --git a/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/formatters/bisect_progress_formatter.rb b/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/formatters/bisect_progress_formatter.rb
new file mode 100644
index 0000000..3b12c21
--- /dev/null
+++ b/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/formatters/bisect_progress_formatter.rb
@@ -0,0 +1,115 @@
+RSpec::Support.require_rspec_core "formatters/base_text_formatter"
+
+module RSpec
+ module Core
+ module Formatters
+ # @private
+ # Produces progress output while bisecting.
+ class BisectProgressFormatter < BaseTextFormatter
+ # We've named all events with a `bisect_` prefix to prevent naming collisions.
+ Formatters.register self, :bisect_starting, :bisect_original_run_complete,
+ :bisect_round_started, :bisect_individual_run_complete,
+ :bisect_round_finished, :bisect_complete, :bisect_repro_command,
+ :bisect_failed, :bisect_aborted
+
+ def bisect_starting(notification)
+ options = notification.original_cli_args.join(' ')
+ output.puts "Bisect started using options: #{options.inspect}"
+ output.print "Running suite to find failures..."
+ end
+
+ def bisect_original_run_complete(notification)
+ failures = Helpers.pluralize(notification.failed_example_ids.size, "failing example")
+ non_failures = Helpers.pluralize(notification.non_failing_example_ids.size, "non-failing example")
+
+ output.puts " (#{Helpers.format_duration(notification.duration)})"
+ output.puts "Starting bisect with #{failures} and #{non_failures}."
+ end
+
+ def bisect_round_started(notification, include_trailing_space=true)
+ search_desc = Helpers.pluralize(
+ notification.subset_size, "non-failing example"
+ )
+
+ output.print "\nRound #{notification.round}: searching for #{search_desc}" \
+ " (of #{notification.remaining_count}) to ignore:"
+ output.print " " if include_trailing_space
+ end
+
+ def bisect_round_finished(notification)
+ output.print " (#{Helpers.format_duration(notification.duration)})"
+ end
+
+ def bisect_individual_run_complete(_)
+ output.print '.'
+ end
+
+ def bisect_complete(notification)
+ output.puts "\nBisect complete! Reduced necessary non-failing examples " \
+ "from #{notification.original_non_failing_count} to " \
+ "#{notification.remaining_count} in " \
+ "#{Helpers.format_duration(notification.duration)}."
+ end
+
+ def bisect_repro_command(notification)
+ output.puts "\nThe minimal reproduction command is:\n #{notification.repro}"
+ end
+
+ def bisect_failed(notification)
+ output.puts "\nBisect failed! #{notification.failure_explanation}"
+ end
+
+ def bisect_aborted(notification)
+ output.puts "\n\nBisect aborted!"
+ output.puts "\nThe most minimal reproduction command discovered so far is:\n #{notification.repro}"
+ end
+ end
+
+ # @private
+ # Produces detailed debug output while bisecting. Used when
+ # bisect is performed while the `DEBUG_RSPEC_BISECT` ENV var is used.
+ # Designed to provide details for us when we need to troubleshoot bisect bugs.
+ class BisectDebugFormatter < BisectProgressFormatter
+ Formatters.register self, :bisect_original_run_complete, :bisect_individual_run_start,
+ :bisect_individual_run_complete, :bisect_round_finished, :bisect_ignoring_ids
+
+ def bisect_original_run_complete(notification)
+ output.puts " (#{Helpers.format_duration(notification.duration)})"
+
+ output.puts " - #{describe_ids 'Failing examples', notification.failed_example_ids}"
+ output.puts " - #{describe_ids 'Non-failing examples', notification.non_failing_example_ids}"
+ end
+
+ def bisect_individual_run_start(notification)
+ output.print "\n - Running: #{notification.command}"
+ end
+
+ def bisect_individual_run_complete(notification)
+ output.print " (#{Helpers.format_duration(notification.duration)})"
+ end
+
+ def bisect_round_started(notification)
+ super(notification, false)
+ end
+
+ def bisect_round_finished(notification)
+ output.print "\n - Round finished"
+ super
+ end
+
+ def bisect_ignoring_ids(notification)
+ output.print "\n - #{describe_ids 'Examples we can safely ignore', notification.ids_to_ignore}"
+ output.print "\n - #{describe_ids 'Remaining non-failing examples', notification.remaining_ids}"
+ end
+
+ private
+
+ def describe_ids(description, ids)
+ organized_ids = Formatters::Helpers.organize_ids(ids)
+ formatted_ids = organized_ids.map { |id| " - #{id}" }.join("\n")
+ "#{description} (#{ids.size}):\n#{formatted_ids}"
+ end
+ end
+ end
+ end
+end
diff --git a/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/formatters/console_codes.rb b/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/formatters/console_codes.rb
new file mode 100644
index 0000000..1419dbc
--- /dev/null
+++ b/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/formatters/console_codes.rb
@@ -0,0 +1,65 @@
+module RSpec
+ module Core
+ module Formatters
+ # ConsoleCodes provides helpers for formatting console output
+ # with ANSI codes, e.g. color's and bold.
+ module ConsoleCodes
+ # @private
+ VT100_CODES =
+ {
+ :black => 30,
+ :red => 31,
+ :green => 32,
+ :yellow => 33,
+ :blue => 34,
+ :magenta => 35,
+ :cyan => 36,
+ :white => 37,
+ :bold => 1,
+ }
+ # @private
+ VT100_CODE_VALUES = VT100_CODES.invert
+
+ module_function
+
+ # @private
+ CONFIG_COLORS_TO_METHODS = Configuration.instance_methods.grep(/_color\z/).inject({}) do |hash, method|
+ hash[method.to_s.sub(/_color\z/, '').to_sym] = method
+ hash
+ end
+
+ # Fetches the correct code for the supplied symbol, or checks
+ # that a code is valid. Defaults to white (37).
+ #
+ # @param code_or_symbol [Symbol, Fixnum] Symbol or code to check
+ # @return [Fixnum] a console code
+ def console_code_for(code_or_symbol)
+ if (config_method = CONFIG_COLORS_TO_METHODS[code_or_symbol])
+ console_code_for RSpec.configuration.__send__(config_method)
+ elsif VT100_CODE_VALUES.key?(code_or_symbol)
+ code_or_symbol
+ else
+ VT100_CODES.fetch(code_or_symbol) do
+ console_code_for(:white)
+ end
+ end
+ end
+
+ # Wraps a piece of text in ANSI codes with the supplied code. Will
+ # only apply the control code if `RSpec.configuration.color_enabled?`
+ # returns true.
+ #
+ # @param text [String] the text to wrap
+ # @param code_or_symbol [Symbol, Fixnum] the desired control code
+ # @return [String] the wrapped text
+ def wrap(text, code_or_symbol)
+ if RSpec.configuration.color_enabled?
+ "\e[#{console_code_for(code_or_symbol)}m#{text}\e[0m"
+ else
+ text
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/formatters/deprecation_formatter.rb b/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/formatters/deprecation_formatter.rb
new file mode 100644
index 0000000..ab90962
--- /dev/null
+++ b/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/formatters/deprecation_formatter.rb
@@ -0,0 +1,223 @@
+RSpec::Support.require_rspec_core "formatters/helpers"
+
+module RSpec
+ module Core
+ module Formatters
+ # @private
+ class DeprecationFormatter
+ Formatters.register self, :deprecation, :deprecation_summary
+
+ attr_reader :count, :deprecation_stream, :summary_stream
+
+ def initialize(deprecation_stream, summary_stream)
+ @deprecation_stream = deprecation_stream
+ @summary_stream = summary_stream
+ @seen_deprecations = Set.new
+ @count = 0
+ end
+ alias :output :deprecation_stream
+
+ def printer
+ @printer ||= case deprecation_stream
+ when File
+ ImmediatePrinter.new(FileStream.new(deprecation_stream),
+ summary_stream, self)
+ when RaiseErrorStream
+ ImmediatePrinter.new(deprecation_stream, summary_stream, self)
+ else
+ DelayedPrinter.new(deprecation_stream, summary_stream, self)
+ end
+ end
+
+ def deprecation(notification)
+ return if @seen_deprecations.include? notification
+
+ @count += 1
+ printer.print_deprecation_message notification
+ @seen_deprecations << notification
+ end
+
+ def deprecation_summary(_notification)
+ printer.deprecation_summary
+ end
+
+ def deprecation_message_for(data)
+ if data.message
+ SpecifiedDeprecationMessage.new(data)
+ else
+ GeneratedDeprecationMessage.new(data)
+ end
+ end
+
+ RAISE_ERROR_CONFIG_NOTICE = <<-EOS.gsub(/^\s+\|/, '')
+ |
+ |If you need more of the backtrace for any of these deprecations to
+ |identify where to make the necessary changes, you can configure
+ |`config.raise_errors_for_deprecations!`, and it will turn the
+ |deprecation warnings into errors, giving you the full backtrace.
+ EOS
+
+ DEPRECATION_STREAM_NOTICE = "Pass `--deprecation-out` or set " \
+ "`config.deprecation_stream` to a file for full output."
+
+ SpecifiedDeprecationMessage = Struct.new(:type) do
+ def initialize(data)
+ @message = data.message
+ super deprecation_type_for(data)
+ end
+
+ def to_s
+ output_formatted @message
+ end
+
+ def too_many_warnings_message
+ msg = "Too many similar deprecation messages reported, disregarding further reports. "
+ msg << DEPRECATION_STREAM_NOTICE
+ msg
+ end
+
+ private
+
+ def output_formatted(str)
+ return str unless str.lines.count > 1
+ separator = "#{'-' * 80}"
+ "#{separator}\n#{str.chomp}\n#{separator}"
+ end
+
+ def deprecation_type_for(data)
+ data.message.gsub(/(\w+\/)+\w+\.rb:\d+/, '')
+ end
+ end
+
+ GeneratedDeprecationMessage = Struct.new(:type) do
+ def initialize(data)
+ @data = data
+ super data.deprecated
+ end
+
+ def to_s
+ msg = "#{@data.deprecated} is deprecated."
+ msg << " Use #{@data.replacement} instead." if @data.replacement
+ msg << " Called from #{@data.call_site}." if @data.call_site
+ msg
+ end
+
+ def too_many_warnings_message
+ msg = "Too many uses of deprecated '#{type}'. "
+ msg << DEPRECATION_STREAM_NOTICE
+ msg
+ end
+ end
+
+ # @private
+ class ImmediatePrinter
+ attr_reader :deprecation_stream, :summary_stream, :deprecation_formatter
+
+ def initialize(deprecation_stream, summary_stream, deprecation_formatter)
+ @deprecation_stream = deprecation_stream
+
+ @summary_stream = summary_stream
+ @deprecation_formatter = deprecation_formatter
+ end
+
+ def print_deprecation_message(data)
+ deprecation_message = deprecation_formatter.deprecation_message_for(data)
+ deprecation_stream.puts deprecation_message.to_s
+ end
+
+ def deprecation_summary
+ return if deprecation_formatter.count.zero?
+ deprecation_stream.summarize(summary_stream, deprecation_formatter.count)
+ end
+ end
+
+ # @private
+ class DelayedPrinter
+ TOO_MANY_USES_LIMIT = 4
+
+ attr_reader :deprecation_stream, :summary_stream, :deprecation_formatter
+
+ def initialize(deprecation_stream, summary_stream, deprecation_formatter)
+ @deprecation_stream = deprecation_stream
+ @summary_stream = summary_stream
+ @deprecation_formatter = deprecation_formatter
+ @seen_deprecations = Hash.new { 0 }
+ @deprecation_messages = Hash.new { |h, k| h[k] = [] }
+ end
+
+ def print_deprecation_message(data)
+ deprecation_message = deprecation_formatter.deprecation_message_for(data)
+ @seen_deprecations[deprecation_message] += 1
+
+ stash_deprecation_message(deprecation_message)
+ end
+
+ def stash_deprecation_message(deprecation_message)
+ if @seen_deprecations[deprecation_message] < TOO_MANY_USES_LIMIT
+ @deprecation_messages[deprecation_message] << deprecation_message.to_s
+ elsif @seen_deprecations[deprecation_message] == TOO_MANY_USES_LIMIT
+ @deprecation_messages[deprecation_message] << deprecation_message.too_many_warnings_message
+ end
+ end
+
+ def deprecation_summary
+ return unless @deprecation_messages.any?
+
+ print_deferred_deprecation_warnings
+ deprecation_stream.puts RAISE_ERROR_CONFIG_NOTICE
+
+ summary_stream.puts "\n#{Helpers.pluralize(deprecation_formatter.count, 'deprecation warning')} total"
+ end
+
+ def print_deferred_deprecation_warnings
+ deprecation_stream.puts "\nDeprecation Warnings:\n\n"
+ @deprecation_messages.keys.sort_by(&:type).each do |deprecation|
+ messages = @deprecation_messages[deprecation]
+ messages.each { |msg| deprecation_stream.puts msg }
+ deprecation_stream.puts
+ end
+ end
+ end
+
+ # @private
+ # Not really a stream, but is usable in place of one.
+ class RaiseErrorStream
+ def puts(message)
+ raise DeprecationError, message
+ end
+
+ def summarize(summary_stream, deprecation_count)
+ summary_stream.puts "\n#{Helpers.pluralize(deprecation_count, 'deprecation')} found."
+ end
+ end
+
+ # @private
+ # Wraps a File object and provides file-specific operations.
+ class FileStream
+ def initialize(file)
+ @file = file
+
+ # In one of my test suites, I got lots of duplicate output in the
+ # deprecation file (e.g. 200 of the same deprecation, even though
+ # the `puts` below was only called 6 times). Setting `sync = true`
+ # fixes this (but we really have no idea why!).
+ @file.sync = true
+ end
+
+ def puts(*args)
+ @file.puts(*args)
+ end
+
+ def summarize(summary_stream, deprecation_count)
+ path = @file.respond_to?(:path) ? @file.path : @file.inspect
+ summary_stream.puts "\n#{Helpers.pluralize(deprecation_count, 'deprecation')} logged to #{path}"
+ puts RAISE_ERROR_CONFIG_NOTICE
+ end
+ end
+ end
+ end
+
+ # Deprecation Error.
+ DeprecationError = Class.new(StandardError)
+ end
+end
diff --git a/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/formatters/documentation_formatter.rb b/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/formatters/documentation_formatter.rb
new file mode 100644
index 0000000..fd50c87
--- /dev/null
+++ b/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/formatters/documentation_formatter.rb
@@ -0,0 +1,70 @@
+RSpec::Support.require_rspec_core "formatters/base_text_formatter"
+
+module RSpec
+ module Core
+ module Formatters
+ # @private
+ class DocumentationFormatter < BaseTextFormatter
+ Formatters.register self, :example_group_started, :example_group_finished,
+ :example_passed, :example_pending, :example_failed
+
+ def initialize(output)
+ super
+ @group_level = 0
+ end
+
+ def example_group_started(notification)
+ output.puts if @group_level == 0
+ output.puts "#{current_indentation}#{notification.group.description.strip}"
+
+ @group_level += 1
+ end
+
+ def example_group_finished(_notification)
+ @group_level -= 1
+ end
+
+ def example_passed(passed)
+ output.puts passed_output(passed.example)
+ end
+
+ def example_pending(pending)
+ output.puts pending_output(pending.example,
+ pending.example.execution_result.pending_message)
+ end
+
+ def example_failed(failure)
+ output.puts failure_output(failure.example,
+ failure.example.execution_result.exception)
+ end
+
+ private
+
+ def passed_output(example)
+ ConsoleCodes.wrap("#{current_indentation}#{example.description.strip}", :success)
+ end
+
+ def pending_output(example, message)
+ ConsoleCodes.wrap("#{current_indentation}#{example.description.strip} " \
+ "(PENDING: #{message})",
+ :pending)
+ end
+
+ def failure_output(example, _exception)
+ ConsoleCodes.wrap("#{current_indentation}#{example.description.strip} " \
+ "(FAILED - #{next_failure_index})",
+ :failure)
+ end
+
+ def next_failure_index
+ @next_failure_index ||= 0
+ @next_failure_index += 1
+ end
+
+ def current_indentation
+ ' ' * @group_level
+ end
+ end
+ end
+ end
+end
diff --git a/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/formatters/exception_presenter.rb b/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/formatters/exception_presenter.rb
new file mode 100644
index 0000000..3afa7c5
--- /dev/null
+++ b/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/formatters/exception_presenter.rb
@@ -0,0 +1,393 @@
+module RSpec
+ module Core
+ module Formatters
+ # @private
+ class ExceptionPresenter
+ attr_reader :exception, :example, :description, :message_color,
+ :detail_formatter, :extra_detail_formatter, :backtrace_formatter
+ private :message_color, :detail_formatter, :extra_detail_formatter, :backtrace_formatter
+
+ def initialize(exception, example, options={})
+ @exception = exception
+ @example = example
+ @message_color = options.fetch(:message_color) { RSpec.configuration.failure_color }
+ @description = options.fetch(:description_formatter) { Proc.new { example.full_description } }.call(self)
+ @detail_formatter = options.fetch(:detail_formatter) { Proc.new {} }
+ @extra_detail_formatter = options.fetch(:extra_detail_formatter) { Proc.new {} }
+ @backtrace_formatter = options.fetch(:backtrace_formatter) { RSpec.configuration.backtrace_formatter }
+ @indentation = options.fetch(:indentation, 2)
+ @skip_shared_group_trace = options.fetch(:skip_shared_group_trace, false)
+ @failure_lines = options[:failure_lines]
+ end
+
+ def message_lines
+ add_shared_group_lines(failure_lines, Notifications::NullColorizer)
+ end
+
+ def colorized_message_lines(colorizer=::RSpec::Core::Formatters::ConsoleCodes)
+ add_shared_group_lines(failure_lines, colorizer).map do |line|
+ colorizer.wrap line, message_color
+ end
+ end
+
+ def formatted_backtrace
+ backtrace_formatter.format_backtrace(exception_backtrace, example.metadata)
+ end
+
+ def colorized_formatted_backtrace(colorizer=::RSpec::Core::Formatters::ConsoleCodes)
+ formatted_backtrace.map do |backtrace_info|
+ colorizer.wrap "# #{backtrace_info}", RSpec.configuration.detail_color
+ end
+ end
+
+ def fully_formatted(failure_number, colorizer=::RSpec::Core::Formatters::ConsoleCodes)
+ alignment_basis = "#{' ' * @indentation}#{failure_number}) "
+ indentation = ' ' * alignment_basis.length
+
+ "\n#{alignment_basis}#{description_and_detail(colorizer, indentation)}" \
+ "\n#{formatted_message_and_backtrace(colorizer, indentation)}" \
+ "#{extra_detail_formatter.call(failure_number, colorizer, indentation)}"
+ end
+
+ def failure_slash_error_line
+ @failure_slash_error_line ||= "Failure/Error: #{read_failed_line.strip}"
+ end
+
+ private
+
+ def description_and_detail(colorizer, indentation)
+ detail = detail_formatter.call(example, colorizer, indentation)
+ return (description || detail) unless description && detail
+ "#{description}\n#{indentation}#{detail}"
+ end
+
+ if String.method_defined?(:encoding)
+ def encoding_of(string)
+ string.encoding
+ end
+
+ def encoded_string(string)
+ RSpec::Support::EncodedString.new(string, Encoding.default_external)
+ end
+ else # for 1.8.7
+ # :nocov:
+ def encoding_of(_string)
+ end
+
+ def encoded_string(string)
+ RSpec::Support::EncodedString.new(string)
+ end
+ # :nocov:
+ end
+
+ def exception_class_name
+ name = exception.class.name.to_s
+ name = "(anonymous error class)" if name == ''
+ name
+ end
+
+ def failure_lines
+ @failure_lines ||=
+ begin
+ lines = []
+ lines << failure_slash_error_line unless (description == failure_slash_error_line)
+ lines << "#{exception_class_name}:" unless exception_class_name =~ /RSpec/
+ encoded_string(exception.message.to_s).split("\n").each do |line|
+ lines << " #{line}"
+ end
+ lines
+ end
+ end
+
+ def add_shared_group_lines(lines, colorizer)
+ return lines if @skip_shared_group_trace
+
+ example.metadata[:shared_group_inclusion_backtrace].each do |frame|
+ lines << colorizer.wrap(frame.description, RSpec.configuration.default_color)
+ end
+
+ lines
+ end
+
+ def read_failed_line
+ matching_line = find_failed_line
+ unless matching_line
+ return "Unable to find matching line from backtrace"
+ end
+
+ file_path, line_number = matching_line.match(/(.+?):(\d+)(|:\d+)/)[1..2]
+
+ if File.exist?(file_path)
+ File.readlines(file_path)[line_number.to_i - 1] ||
+ "Unable to find matching line in #{file_path}"
+ else
+ "Unable to find #{file_path} to read failed line"
+ end
+ rescue SecurityError
+ "Unable to read failed line"
+ end
+
+ def find_failed_line
+ example_path = example.metadata[:absolute_file_path].downcase
+ exception_backtrace.find do |line|
+ next unless (line_path = line[/(.+?):(\d+)(|:\d+)/, 1])
+ File.expand_path(line_path).downcase == example_path
+ end
+ end
+
+ def formatted_message_and_backtrace(colorizer, indentation)
+ lines = colorized_message_lines(colorizer) + colorized_formatted_backtrace(colorizer)
+
+ formatted = ""
+
+ lines.each do |line|
+ formatted << RSpec::Support::EncodedString.new("#{indentation}#{line}\n", encoding_of(formatted))
+ end
+
+ formatted
+ end
+
+ def exception_backtrace
+ exception.backtrace || []
+ end
+
+ # @private
+ # Configuring the `ExceptionPresenter` with the right set of options to handle
+ # pending vs failed vs skipped and aggregated (or not) failures is not simple.
+ # This class takes care of building an appropriate `ExceptionPresenter` for the
+ # provided example.
+ class Factory
+ def build
+ ExceptionPresenter.new(@exception, @example, options)
+ end
+
+ private
+
+ def initialize(example)
+ @example = example
+ @execution_result = example.execution_result
+ @exception = if @execution_result.status == :pending
+ @execution_result.pending_exception
+ else
+ @execution_result.exception
+ end
+ end
+
+ def options
+ with_multiple_error_options_as_needed(@exception, pending_options || {})
+ end
+
+ def pending_options
+ if @execution_result.pending_fixed?
+ {
+ :description_formatter => Proc.new { "#{@example.full_description} FIXED" },
+ :message_color => RSpec.configuration.fixed_color,
+ :failure_lines => [
+ "Expected pending '#{@execution_result.pending_message}' to fail. No Error was raised."
+ ]
+ }
+ elsif @execution_result.status == :pending
+ {
+ :message_color => RSpec.configuration.pending_color,
+ :detail_formatter => PENDING_DETAIL_FORMATTER
+ }
+ end
+ end
+
+ def with_multiple_error_options_as_needed(exception, options)
+ return options unless multiple_exceptions_error?(exception)
+
+ options = options.merge(
+ :failure_lines => [],
+ :extra_detail_formatter => sub_failure_list_formatter(exception, options[:message_color]),
+ :detail_formatter => multiple_exception_summarizer(exception,
+ options[:detail_formatter],
+ options[:message_color])
+ )
+
+ options[:description_formatter] &&= Proc.new {}
+
+ return options unless exception.aggregation_metadata[:hide_backtrace]
+ options[:backtrace_formatter] = EmptyBacktraceFormatter
+ options
+ end
+
+ def multiple_exceptions_error?(exception)
+ MultipleExceptionError::InterfaceTag === exception
+ end
+
+ def multiple_exception_summarizer(exception, prior_detail_formatter, color)
+ lambda do |example, colorizer, indentation|
+ summary = if exception.aggregation_metadata[:hide_backtrace]
+ # Since the backtrace is hidden, the subfailures will come
+ # immediately after this, and using `:` will read well.
+ "Got #{exception.exception_count_description}:"
+ else
+ # The backtrace comes after this, so using a `:` doesn't make sense
+ # since the failures may be many lines below.
+ "#{exception.summary}."
+ end
+
+ summary = colorizer.wrap(summary, color || RSpec.configuration.failure_color)
+ return summary unless prior_detail_formatter
+ "#{prior_detail_formatter.call(example, colorizer, indentation)}\n#{indentation}#{summary}"
+ end
+ end
+
+ def sub_failure_list_formatter(exception, message_color)
+ common_backtrace_truncater = CommonBacktraceTruncater.new(exception)
+
+ lambda do |failure_number, colorizer, indentation|
+ exception.all_exceptions.each_with_index.map do |failure, index|
+ options = with_multiple_error_options_as_needed(
+ failure,
+ :description_formatter => :failure_slash_error_line.to_proc,
+ :indentation => indentation.length,
+ :message_color => message_color || RSpec.configuration.failure_color,
+ :skip_shared_group_trace => true
+ )
+
+ failure = common_backtrace_truncater.with_truncated_backtrace(failure)
+ presenter = ExceptionPresenter.new(failure, @example, options)
+ presenter.fully_formatted("#{failure_number}.#{index + 1}", colorizer)
+ end.join
+ end
+ end
+
+ # @private
+ # Used to prevent a confusing backtrace from showing up from the `aggregate_failures`
+ # block declared for `:aggregate_failures` metadata.
+ module EmptyBacktraceFormatter
+ def self.format_backtrace(*)
+ []
+ end
+ end
+
+ # @private
+ class CommonBacktraceTruncater
+ def initialize(parent)
+ @parent = parent
+ end
+
+ def with_truncated_backtrace(child)
+ child_bt = child.backtrace
+ parent_bt = @parent.backtrace
+ return child if child_bt.nil? || child_bt.empty? || parent_bt.nil?
+
+ index_before_first_common_frame = -1.downto(-child_bt.size).find do |index|
+ parent_bt[index] != child_bt[index]
+ end
+
+ return child if index_before_first_common_frame == -1
+
+ child = child.dup
+ child.set_backtrace(child_bt[0..index_before_first_common_frame])
+ child
+ end
+ end
+ end
+
+ # @private
+ PENDING_DETAIL_FORMATTER = Proc.new do |example, colorizer|
+ colorizer.wrap("# #{example.execution_result.pending_message}", :detail)
+ end
+ end
+ end
+
+ # Provides a single exception instance that provides access to
+ # multiple sub-exceptions. This is used in situations where a single
+ # individual spec has multiple exceptions, such as one in the `it` block
+ # and one in an `after` block.
+ class MultipleExceptionError < StandardError
+ # @private
+ # Used so there is a common module in the ancestor chain of this class
+ # and `RSpec::Expectations::MultipleExpectationsNotMetError`, which allows
+ # code to detect exceptions that are instances of either, without first
+ # checking to see if rspec-expectations is loaded.
+ module InterfaceTag
+ # Appends the provided exception to the list.
+ # @param exception [Exception] Exception to append to the list.
+ # @private
+ def add(exception)
+ # `PendingExampleFixedError` can be assigned to an example that initially has no
+ # failures, but when the `aggregate_failures` around hook completes, it notifies of
+ # a failure. If we do not ignore `PendingExampleFixedError` it would be surfaced to
+ # the user as part of a multiple exception error, which is undesirable. While it's
+ # pretty weird we handle this here, it's the best solution I've been able to come
+ # up with, and `PendingExampleFixedError` always represents the _lack_ of any exception
+ # so clearly when we are transitioning to a `MultipleExceptionError`, it makes sense to
+ # ignore it.
+ return if Pending::PendingExampleFixedError === exception
+
+ all_exceptions << exception
+
+ if exception.class.name =~ /RSpec/
+ failures << exception
+ else
+ other_errors << exception
+ end
+ end
+
+ # Provides a way to force `ex` to be something that satisfies the multiple
+ # exception error interface. If it already satisfies it, it will be returned;
+ # otherwise it will wrap it in a `MultipleExceptionError`.
+ # @private
+ def self.for(ex)
+ return ex if self === ex
+ MultipleExceptionError.new(ex)
+ end
+ end
+
+ include InterfaceTag
+
+ # @return [Array] The list of failures.
+ attr_reader :failures
+
+ # @return [Array] The list of other errors.
+ attr_reader :other_errors
+
+ # @return [Array] The list of failures and other exceptions, combined.
+ attr_reader :all_exceptions
+
+ # @return [Hash] Metadata used by RSpec for formatting purposes.
+ attr_reader :aggregation_metadata
+
+ # @return [nil] Provided only for interface compatibility with
+ # `RSpec::Expectations::MultipleExpectationsNotMetError`.
+ attr_reader :aggregation_block_label
+
+ # @param exceptions [Array] The initial list of exceptions.
+ def initialize(*exceptions)
+ super()
+
+ @failures = []
+ @other_errors = []
+ @all_exceptions = []
+ @aggregation_metadata = { :hide_backtrace => true }
+ @aggregation_block_label = nil
+
+ exceptions.each { |e| add e }
+ end
+
+ # @return [String] Combines all the exception messages into a single string.
+ # @note RSpec does not actually use this -- instead it formats each exception
+ # individually.
+ def message
+ all_exceptions.map(&:message).join("\n\n")
+ end
+
+ # @return [String] A summary of the failure, including the block label and a count of failures.
+ def summary
+ "Got #{exception_count_description}"
+ end
+
+ # return [String] A description of the failure/error counts.
+ def exception_count_description
+ failure_count = Formatters::Helpers.pluralize(failures.size, "failure")
+ return failure_count if other_errors.empty?
+ error_count = Formatters::Helpers.pluralize(other_errors.size, "other error")
+ "#{failure_count} and #{error_count}"
+ end
+ end
+ end
+end
diff --git a/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/formatters/fallback_message_formatter.rb b/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/formatters/fallback_message_formatter.rb
new file mode 100644
index 0000000..db4423f
--- /dev/null
+++ b/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/formatters/fallback_message_formatter.rb
@@ -0,0 +1,28 @@
+module RSpec
+ module Core
+ module Formatters
+ # @api private
+ # Formatter for providing message output as a fallback when no other
+ # profiler implements #message
+ class FallbackMessageFormatter
+ Formatters.register self, :message
+
+ def initialize(output)
+ @output = output
+ end
+
+ # @private
+ attr_reader :output
+
+ # @api public
+ #
+ # Used by the reporter to send messages to the output stream.
+ #
+ # @param notification [MessageNotification] containing message
+ def message(notification)
+ output.puts notification.message
+ end
+ end
+ end
+ end
+end
diff --git a/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/formatters/helpers.rb b/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/formatters/helpers.rb
new file mode 100644
index 0000000..3d3b0f5
--- /dev/null
+++ b/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/formatters/helpers.rb
@@ -0,0 +1,109 @@
+RSpec::Support.require_rspec_core "shell_escape"
+
+module RSpec
+ module Core
+ module Formatters
+ # Formatters helpers.
+ module Helpers
+ # @private
+ SUB_SECOND_PRECISION = 5
+
+ # @private
+ DEFAULT_PRECISION = 2
+
+ # @api private
+ #
+ # Formats seconds into a human-readable string.
+ #
+ # @param duration [Float, Fixnum] in seconds
+ # @return [String] human-readable time
+ #
+ # @example
+ # format_duration(1) #=> "1 minute 1 second"
+ # format_duration(135.14) #=> "2 minutes 15.14 seconds"
+ def self.format_duration(duration)
+ precision = case
+ when duration < 1 then SUB_SECOND_PRECISION
+ when duration < 120 then DEFAULT_PRECISION
+ when duration < 300 then 1
+ else 0
+ end
+
+ if duration > 60
+ minutes = (duration.to_i / 60).to_i
+ seconds = duration - minutes * 60
+
+ "#{pluralize(minutes, 'minute')} #{pluralize(format_seconds(seconds, precision), 'second')}"
+ else
+ pluralize(format_seconds(duration, precision), 'second')
+ end
+ end
+
+ # @api private
+ #
+ # Formats seconds to have 5 digits of precision with trailing zeros
+ # removed if the number is less than 1 or with 2 digits of precision if
+ # the number is greater than zero.
+ #
+ # @param float [Float]
+ # @return [String] formatted float
+ #
+ # @example
+ # format_seconds(0.000006) #=> "0.00001"
+ # format_seconds(0.020000) #=> "0.02"
+ # format_seconds(1.00000000001) #=> "1"
+ #
+ # The precision used is set in {Helpers::SUB_SECOND_PRECISION} and
+ # {Helpers::DEFAULT_PRECISION}.
+ #
+ # @see #strip_trailing_zeroes
+ def self.format_seconds(float, precision=nil)
+ precision ||= (float < 1) ? SUB_SECOND_PRECISION : DEFAULT_PRECISION
+ formatted = "%.#{precision}f" % float
+ strip_trailing_zeroes(formatted)
+ end
+
+ # @api private
+ #
+ # Remove trailing zeros from a string.
+ #
+ # Only remove trailing zeros after a decimal place.
+ # see: http://rubular.com/r/ojtTydOgpn
+ #
+ # @param string [String] string with trailing zeros
+ # @return [String] string with trailing zeros removed
+ def self.strip_trailing_zeroes(string)
+ string.sub(/(?:(\..*[^0])0+|\.0+)$/, '\1')
+ end
+ private_class_method :strip_trailing_zeroes
+
+ # @api private
+ #
+ # Pluralize a word based on a count.
+ #
+ # @param count [Fixnum] number of objects
+ # @param string [String] word to be pluralized
+ # @return [String] pluralized word
+ def self.pluralize(count, string)
+ "#{count} #{string}#{'s' unless count.to_f == 1}"
+ end
+
+ # @api private
+ # Given a list of example ids, organizes them into a compact, ordered list.
+ def self.organize_ids(ids)
+ grouped = ids.inject(Hash.new { |h, k| h[k] = [] }) do |hash, id|
+ file, id = id.split(Configuration::ON_SQUARE_BRACKETS)
+ hash[file] << id
+ hash
+ end
+
+ grouped.sort_by(&:first).map do |file, grouped_ids|
+ grouped_ids = grouped_ids.sort_by { |id| id.split(':').map(&:to_i) }
+ id = Metadata.id_from(:rerun_file_path => file, :scoped_id => grouped_ids.join(','))
+ ShellEscape.conditionally_quote(id)
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/formatters/html_formatter.rb b/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/formatters/html_formatter.rb
new file mode 100644
index 0000000..4644c01
--- /dev/null
+++ b/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/formatters/html_formatter.rb
@@ -0,0 +1,151 @@
+RSpec::Support.require_rspec_core "formatters/base_text_formatter"
+RSpec::Support.require_rspec_core "formatters/html_printer"
+
+module RSpec
+ module Core
+ module Formatters
+ # @private
+ class HtmlFormatter < BaseFormatter
+ Formatters.register self, :start, :example_group_started, :start_dump,
+ :example_started, :example_passed, :example_failed,
+ :example_pending, :dump_summary
+
+ def initialize(output)
+ super(output)
+ @failed_examples = []
+ @example_group_number = 0
+ @example_number = 0
+ @header_red = nil
+ @printer = HtmlPrinter.new(output)
+ end
+
+ def start(notification)
+ super
+ @printer.print_html_start
+ @printer.flush
+ end
+
+ def example_group_started(notification)
+ super
+ @example_group_red = false
+ @example_group_number += 1
+
+ @printer.print_example_group_end unless example_group_number == 1
+ @printer.print_example_group_start(example_group_number,
+ notification.group.description,
+ notification.group.parent_groups.size)
+ @printer.flush
+ end
+
+ def start_dump(_notification)
+ @printer.print_example_group_end
+ @printer.flush
+ end
+
+ def example_started(_notification)
+ @example_number += 1
+ end
+
+ def example_passed(passed)
+ @printer.move_progress(percent_done)
+ @printer.print_example_passed(passed.example.description, passed.example.execution_result.run_time)
+ @printer.flush
+ end
+
+ def example_failed(failure)
+ @failed_examples << failure.example
+ unless @header_red
+ @header_red = true
+ @printer.make_header_red
+ end
+
+ unless @example_group_red
+ @example_group_red = true
+ @printer.make_example_group_header_red(example_group_number)
+ end
+
+ @printer.move_progress(percent_done)
+
+ example = failure.example
+
+ exception = failure.exception
+ exception_details = if exception
+ {
+ :message => exception.message,
+ :backtrace => failure.formatted_backtrace.join("\n")
+ }
+ end
+ extra = extra_failure_content(failure)
+
+ @printer.print_example_failed(
+ example.execution_result.pending_fixed,
+ example.description,
+ example.execution_result.run_time,
+ @failed_examples.size,
+ exception_details,
+ (extra == "") ? false : extra
+ )
+ @printer.flush
+ end
+
+ def example_pending(pending)
+ example = pending.example
+
+ @printer.make_header_yellow unless @header_red
+ @printer.make_example_group_header_yellow(example_group_number) unless @example_group_red
+ @printer.move_progress(percent_done)
+ @printer.print_example_pending(example.description, example.execution_result.pending_message)
+ @printer.flush
+ end
+
+ def dump_summary(summary)
+ @printer.print_summary(
+ summary.duration,
+ summary.example_count,
+ summary.failure_count,
+ summary.pending_count
+ )
+ @printer.flush
+ end
+
+ private
+
+ # If these methods are declared with attr_reader Ruby will issue a
+ # warning because they are private.
+ # rubocop:disable Style/TrivialAccessors
+
+ # The number of the currently running example_group.
+ def example_group_number
+ @example_group_number
+ end
+
+ # The number of the currently running example (a global counter).
+ def example_number
+ @example_number
+ end
+ # rubocop:enable Style/TrivialAccessors
+
+ def percent_done
+ result = 100.0
+ if @example_count > 0
+ result = (((example_number).to_f / @example_count.to_f * 1000).to_i / 10.0).to_f
+ end
+ result
+ end
+
+ # Override this method if you wish to output extra HTML for a failed
+ # spec. For example, you could output links to images or other files
+ # produced during the specs.
+ def extra_failure_content(failure)
+ RSpec::Support.require_rspec_core "formatters/snippet_extractor"
+ backtrace = (failure.exception.backtrace || []).map do |line|
+ RSpec.configuration.backtrace_formatter.backtrace_line(line)
+ end
+ backtrace.compact!
+ @snippet_extractor ||= SnippetExtractor.new
+ " #{@snippet_extractor.snippet(backtrace)}
"
+ end
+ end
+ end
+ end
+end
diff --git a/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/formatters/html_printer.rb b/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/formatters/html_printer.rb
new file mode 100644
index 0000000..dfb68a9
--- /dev/null
+++ b/.bundle/gems/rspec-core-3.3.2/lib/rspec/core/formatters/html_printer.rb
@@ -0,0 +1,415 @@
+require 'erb'
+
+module RSpec
+ module Core
+ module Formatters
+ # @private
+ class HtmlPrinter
+ include ERB::Util # For the #h method.
+ def initialize(output)
+ @output = output
+ end
+
+ def print_html_start
+ @output.puts HTML_HEADER
+ @output.puts REPORT_HEADER
+ end
+
+ def print_example_group_end
+ @output.puts " "
+ @output.puts "
#{h exception[:backtrace]}