diff --git a/.gitignore b/.gitignore index 853230d7..4100963f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ /config/additional_environment.rb +/config/configuration.yml /config/database.yml /config/email.yml /config/initializers/session_store.rb diff --git a/.hgignore b/.hgignore index cded71b3..5f41fda1 100644 --- a/.hgignore +++ b/.hgignore @@ -1,6 +1,7 @@ syntax: glob config/additional_environment.rb +config/configuration.yml config/database.yml config/email.yml config/initializers/session_store.rb diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index 5fa56b16..0c645e55 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -203,12 +203,24 @@ class AccountController < ApplicationController self.logged_user = user # generate a key and set cookie if autologin if params[:autologin] && Setting.autologin? - token = Token.create(:user => user, :action => 'autologin') - cookies[:autologin] = { :value => token.value, :expires => 1.year.from_now } + set_autologin_cookie(user) end call_hook(:controller_account_success_authentication_after, {:user => user }) redirect_back_or_default :controller => 'my', :action => 'page' end + + def set_autologin_cookie(user) + token = Token.create(:user => user, :action => 'autologin') + cookie_name = Redmine::Configuration['autologin_cookie_name'] || 'autologin' + cookie_options = { + :value => token.value, + :expires => 1.year.from_now, + :path => (Redmine::Configuration['autologin_cookie_path'] || '/'), + :secure => (Redmine::Configuration['autologin_cookie_secure'] ? true : false), + :httponly => true + } + cookies[cookie_name] = cookie_options + end # Onthefly creation failed, display the registration form to fill/fix attributes def onthefly_creation_failed(user, auth_source_options = { }) diff --git a/app/controllers/issue_relations_controller.rb b/app/controllers/issue_relations_controller.rb index 7462adca..b095df37 100644 --- a/app/controllers/issue_relations_controller.rb +++ b/app/controllers/issue_relations_controller.rb @@ -28,6 +28,7 @@ class IssueRelationsController < ApplicationController respond_to do |format| format.html { redirect_to :controller => 'issues', :action => 'show', :id => @issue } format.js do + @relations = @issue.relations.select {|r| r.other_issue(@issue) && r.other_issue(@issue).visible? } render :update do |page| page.replace_html "relations", :partial => 'issues/relations' if @relation.errors.empty? @@ -47,7 +48,10 @@ class IssueRelationsController < ApplicationController end respond_to do |format| format.html { redirect_to :controller => 'issues', :action => 'show', :id => @issue } - format.js { render(:update) {|page| page.replace_html "relations", :partial => 'issues/relations'} } + format.js { + @relations = @issue.relations.select {|r| r.other_issue(@issue) && r.other_issue(@issue).visible? } + render(:update) {|page| page.replace_html "relations", :partial => 'issues/relations'} + } end end diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 3d1dbe9f..051f8910 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -108,6 +108,7 @@ class IssuesController < ApplicationController @journals.reverse! if User.current.wants_comments_in_reverse_order? @changesets = @issue.changesets.visible.all @changesets.reverse! if User.current.wants_comments_in_reverse_order? + @relations = @issue.relations.select {|r| r.other_issue(@issue) && r.other_issue(@issue).visible? } @allowed_statuses = @issue.new_statuses_allowed_to(User.current) @edit_allowed = User.current.allowed_to?(:edit_issues, @project) @priorities = IssuePriority.all diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index b5f70e3f..50a6ff4a 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -94,6 +94,7 @@ class RepositoriesController < ApplicationController (show_error_not_found; return) unless @entry @changesets = @repository.latest_changesets(@path, @rev, Setting.repository_log_display_limit.to_i) @properties = @repository.properties(@path, @rev) + @changeset = @repository.find_changeset_by_name(@rev) end def revisions @@ -127,17 +128,19 @@ class RepositoriesController < ApplicationController else # Prevent empty lines when displaying a file with Windows style eol @content.gsub!("\r\n", "\n") + @changeset = @repository.find_changeset_by_name(@rev) end end - + def annotate @entry = @repository.entry(@path, @rev) (show_error_not_found; return) unless @entry @annotate = @repository.scm.annotate(@path, @rev) (render_error l(:error_scm_annotate); return) if @annotate.nil? || @annotate.empty? + @changeset = @repository.find_changeset_by_name(@rev) end - + def revision raise ChangesetNotFound if @rev.blank? @changeset = @repository.find_changeset_by_name(@rev) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index f04e5491..c6d88487 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -109,6 +109,20 @@ module ApplicationHelper link_to(text, {:controller => 'repositories', :action => 'revision', :id => project, :rev => rev}, :title => l(:label_revision_id, format_revision(revision))) end + + # Generates a link to a message + def link_to_message(message, options={}, html_options = nil) + link_to( + h(truncate(message.subject, :length => 60)), + { :controller => 'messages', :action => 'show', + :board_id => message.board_id, + :id => message.root, + :r => (message.parent_id && message.id), + :anchor => (message.parent_id ? "message-#{message.id}" : nil) + }.merge(options), + html_options + ) + end # Generates a link to a project if active # Examples: @@ -588,16 +602,26 @@ module ApplicationHelper # source:some/file#L120 -> Link to line 120 of the file # source:some/file@52#L120 -> Link to line 120 of the file's revision 52 # export:some/file -> Force the download of the file - # Forum messages: + # Forum messages: # message#1218 -> Link to message with id 1218 + # + # Links can refer other objects from other projects, using project identifier: + # identifier:r52 + # identifier:document:"Some document" + # identifier:version:1.0.0 + # identifier:source:some/file def parse_redmine_links(text, project, obj, attr, only_path, options) - text.gsub!(%r{([\s\(,\-\[\>]|^)(!)?(attachment|document|version|commit|source|export|message|project)?((#|r)(\d+)|(:)([^"\s<>][^\s<>]*?|"[^"]+?"))(?=(?=[[:punct:]]\W)|,|\s|\]|<|$)}) do |m| - leading, esc, prefix, sep, identifier = $1, $2, $3, $5 || $7, $6 || $8 + text.gsub!(%r{([\s\(,\-\[\>]|^)(!)?(([a-z0-9\-]+):)?(attachment|document|version|commit|source|export|message|project)?((#|r)(\d+)|(:)([^"\s<>][^\s<>]*?|"[^"]+?"))(?=(?=[[:punct:]]\W)|,|\s|\]|<|$)}) do |m| + leading, esc, project_prefix, project_identifier, prefix, sep, identifier = $1, $2, $3, $4, $5, $7 || $9, $8 || $10 link = nil + if project_identifier + project = Project.visible.find_by_identifier(project_identifier) + end if esc.nil? if prefix.nil? && sep == 'r' - if project && (changeset = project.changesets.find_by_revision(identifier)) - link = link_to("r#{identifier}", {:only_path => only_path, :controller => 'repositories', :action => 'revision', :id => project, :rev => changeset.revision}, + # project.changesets.visible raises an SQL error because of a double join on repositories + if project && project.repository && (changeset = Changeset.visible.find_by_repository_id_and_revision(project.repository.id, identifier)) + link = link_to("#{project_prefix}r#{identifier}", {:only_path => only_path, :controller => 'repositories', :action => 'revision', :id => project, :rev => changeset.revision}, :class => 'changeset', :title => truncate_single_line(changeset.comments, :length => 100)) end @@ -611,24 +635,18 @@ module ApplicationHelper :title => "#{truncate(issue.subject, :length => 100)} (#{issue.status.name})") end when 'document' - if document = Document.find_by_id(oid, :include => [:project], :conditions => Project.visible_by(User.current)) + if document = Document.visible.find_by_id(oid) link = link_to h(document.title), {:only_path => only_path, :controller => 'documents', :action => 'show', :id => document}, :class => 'document' end when 'version' - if version = Version.find_by_id(oid, :include => [:project], :conditions => Project.visible_by(User.current)) + if version = Version.visible.find_by_id(oid) link = link_to h(version.name), {:only_path => only_path, :controller => 'versions', :action => 'show', :id => version}, :class => 'version' end when 'message' - if message = Message.find_by_id(oid, :include => [:parent, {:board => :project}], :conditions => Project.visible_by(User.current)) - link = link_to h(truncate(message.subject, :length => 60)), {:only_path => only_path, - :controller => 'messages', - :action => 'show', - :board_id => message.board, - :id => message.root, - :anchor => (message.parent ? "message-#{message.id}" : nil)}, - :class => 'message' + if message = Message.visible.find_by_id(oid, :include => :parent) + link = link_to_message(message, {:only_path => only_path}, :class => 'message') end when 'project' if p = Project.visible.find_by_id(oid) @@ -640,26 +658,26 @@ module ApplicationHelper name = identifier.gsub(%r{^"(.*)"$}, "\\1") case prefix when 'document' - if project && document = project.documents.find_by_title(name) + if project && document = project.documents.visible.find_by_title(name) link = link_to h(document.title), {:only_path => only_path, :controller => 'documents', :action => 'show', :id => document}, :class => 'document' end when 'version' - if project && version = project.versions.find_by_name(name) + if project && version = project.versions.visible.find_by_name(name) link = link_to h(version.name), {:only_path => only_path, :controller => 'versions', :action => 'show', :id => version}, :class => 'version' end when 'commit' - if project && (changeset = project.changesets.find(:first, :conditions => ["scmid LIKE ?", "#{name}%"])) - link = link_to h("#{name}"), {:only_path => only_path, :controller => 'repositories', :action => 'revision', :id => project, :rev => changeset.identifier}, + if project && project.repository && (changeset = Changeset.visible.find(:first, :conditions => ["repository_id = ? AND scmid LIKE ?", project.repository.id, "#{name}%"])) + link = link_to h("#{project_prefix}#{name}"), {:only_path => only_path, :controller => 'repositories', :action => 'revision', :id => project, :rev => changeset.identifier}, :class => 'changeset', :title => truncate_single_line(changeset.comments, :length => 100) end when 'source', 'export' - if project && project.repository + if project && project.repository && User.current.allowed_to?(:browse_repository, project) name =~ %r{^[/\\]*(.*?)(@([0-9a-f]+))?(#(L\d+))?$} path, rev, anchor = $1, $3, $5 - link = link_to h("#{prefix}:#{name}"), {:controller => 'repositories', :action => 'entry', :id => project, + link = link_to h("#{project_prefix}#{prefix}:#{name}"), {:controller => 'repositories', :action => 'entry', :id => project, :path => to_path_param(path), :rev => rev, :anchor => anchor, @@ -679,7 +697,7 @@ module ApplicationHelper end end end - leading + (link || "#{prefix}#{sep}#{identifier}") + leading + (link || "#{project_prefix}#{prefix}#{sep}#{identifier}") end end diff --git a/app/helpers/messages_helper.rb b/app/helpers/messages_helper.rb index ed58ad79..ce118b4f 100644 --- a/app/helpers/messages_helper.rb +++ b/app/helpers/messages_helper.rb @@ -16,14 +16,4 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. module MessagesHelper - - def link_to_message(message) - return '' unless message - link_to h(truncate(message.subject, :length => 60)), :controller => 'messages', - :action => 'show', - :board_id => message.board_id, - :id => message.root, - :r => (message.parent_id && message.id), - :anchor => (message.parent_id ? "message-#{message.id}" : nil) - end end diff --git a/app/models/attachment.rb b/app/models/attachment.rb index 99e461dc..93a1534e 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -43,7 +43,7 @@ class Attachment < ActiveRecord::Base "LEFT JOIN #{Project.table_name} ON #{Document.table_name}.project_id = #{Project.table_name}.id"} cattr_accessor :storage_path - @@storage_path = "#{RAILS_ROOT}/files" + @@storage_path = Redmine::Configuration['attachments_storage_path'] || "#{RAILS_ROOT}/files" def validate if self.filesize > Setting.attachment_max_size.to_i.kilobytes diff --git a/app/models/document.rb b/app/models/document.rb index 3aae3985..21232a2d 100644 --- a/app/models/document.rb +++ b/app/models/document.rb @@ -29,6 +29,9 @@ class Document < ActiveRecord::Base validates_presence_of :project, :title, :category validates_length_of :title, :maximum => 60 + named_scope :visible, lambda {|*args| { :include => :project, + :conditions => Project.allowed_to_condition(args.first || User.current, :view_documents) } } + def visible?(user=User.current) !user.nil? && user.allowed_to?(:view_documents, project) end diff --git a/app/models/issue.rb b/app/models/issue.rb index 4892a71b..40b64f3e 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -34,7 +34,7 @@ class Issue < ActiveRecord::Base has_many :relations_from, :class_name => 'IssueRelation', :foreign_key => 'issue_from_id', :dependent => :delete_all has_many :relations_to, :class_name => 'IssueRelation', :foreign_key => 'issue_to_id', :dependent => :delete_all - acts_as_nested_set :scope => 'root_id' + acts_as_nested_set :scope => 'root_id', :dependent => :destroy acts_as_attachable :after_remove => :attachment_removed acts_as_customizable acts_as_watchable @@ -89,7 +89,6 @@ class Issue < ActiveRecord::Base before_create :default_assign before_save :close_duplicates, :update_done_ratio_from_issue_status after_save :reschedule_following_issues, :update_nested_set_attributes, :update_parent_attributes, :create_journal - after_destroy :destroy_children after_destroy :update_parent_attributes # Returns true if usr or current user is allowed to view the issue @@ -758,14 +757,6 @@ class Issue < ActiveRecord::Base end end - def destroy_children - unless leaf? - children.each do |child| - child.destroy - end - end - end - # Update issues so their versions are not pointing to a # fixed_version that is not shared with the issue's project def self.update_versions(conditions=nil) diff --git a/app/models/mailer.rb b/app/models/mailer.rb index e88e740a..2d18a2c7 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -296,7 +296,7 @@ class Mailer < ActionMailer::Base if raise_errors raise e elsif mylogger - mylogger.error "The following error occured while sending email notification: \"#{e.message}\". Check your configuration in config/email.yml." + mylogger.error "The following error occured while sending email notification: \"#{e.message}\". Check your configuration in config/configuration.yml." end ensure self.class.raise_delivery_errors = raise_errors diff --git a/app/models/message.rb b/app/models/message.rb index 3744c239..77c9ff55 100644 --- a/app/models/message.rb +++ b/app/models/message.rb @@ -42,6 +42,9 @@ class Message < ActiveRecord::Base after_create :add_author_as_watcher + named_scope :visible, lambda {|*args| { :include => {:board => :project}, + :conditions => Project.allowed_to_condition(args.first || User.current, :view_messages) } } + def visible?(user=User.current) !user.nil? && user.allowed_to?(:view_messages, project) end diff --git a/app/models/repository/cvs.rb b/app/models/repository/cvs.rb index 82082b3d..dbbb4694 100644 --- a/app/models/repository/cvs.rb +++ b/app/models/repository/cvs.rb @@ -104,10 +104,11 @@ class Repository::Cvs < Repository scm.revisions('', fetch_since, nil, :with_paths => true) do |revision| # only add the change to the database, if it doen't exists. the cvs log # is not exclusive at all. - unless changes.find_by_path_and_revision(scm.with_leading_slash(revision.paths[0][:path]), revision.paths[0][:revision]) - revision + tmp_time = revision.time.clone + unless changes.find_by_path_and_revision( + scm.with_leading_slash(revision.paths[0][:path]), revision.paths[0][:revision]) cs = changesets.find(:first, :conditions=>{ - :committed_on=>revision.time-time_delta..revision.time+time_delta, + :committed_on=>tmp_time - time_delta .. tmp_time + time_delta, :committer=>revision.author, :comments=>Changeset.normalize_comments(revision.message) }) @@ -116,11 +117,14 @@ class Repository::Cvs < Repository unless cs # we use a temporaray revision number here (just for inserting) # later on, we calculate a continous positive number - latest = changesets.find(:first, :order => 'id DESC') + tmp_time2 = tmp_time.clone.gmtime + branch = revision.paths[0][:branch] + scmid = branch + "-" + tmp_time2.strftime("%Y%m%d-%H%M%S") cs = Changeset.create(:repository => self, - :revision => "_#{tmp_rev_num}", + :revision => "tmp#{tmp_rev_num}", + :scmid => scmid, :committer => revision.author, - :committed_on => revision.time, + :committed_on => tmp_time, :comments => revision.message) tmp_rev_num += 1 end @@ -144,10 +148,13 @@ class Repository::Cvs < Repository end # Renumber new changesets in chronological order - changesets.find(:all, :order => 'committed_on ASC, id ASC', :conditions => "revision LIKE '_%'").each do |changeset| + changesets.find( + :all, :order => 'committed_on ASC, id ASC', :conditions => "revision LIKE 'tmp%'" + ).each do |changeset| changeset.update_attribute :revision, next_revision_number end end # transaction + @current_revision_number = nil end private @@ -155,7 +162,9 @@ class Repository::Cvs < Repository # Returns the next revision number to assign to a CVS changeset def next_revision_number # Need to retrieve existing revision numbers to sort them as integers - @current_revision_number ||= (connection.select_values("SELECT revision FROM #{Changeset.table_name} WHERE repository_id = #{id} AND revision NOT LIKE '_%'").collect(&:to_i).max || 0) + sql = "SELECT revision FROM #{Changeset.table_name} " + sql << "WHERE repository_id = #{id} AND revision NOT LIKE 'tmp%'" + @current_revision_number ||= (connection.select_values(sql).collect(&:to_i).max || 0) @current_revision_number += 1 end end diff --git a/app/models/user.rb b/app/models/user.rb index 7d0014c8..d7b1bfb6 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -260,12 +260,16 @@ class User < Principal notified_projects_ids end - # Only users that belong to more than 1 project can select projects for which they are notified def valid_notification_options + self.class.valid_notification_options(self) + end + + # Only users that belong to more than 1 project can select projects for which they are notified + def self.valid_notification_options(user=nil) # Note that @user.membership.size would fail since AR ignores # :include association option when doing a count - if memberships.length < 1 - MAIL_NOTIFICATION_OPTIONS.delete_if {|option| option.first == 'selected'} + if user.nil? || user.memberships.length < 1 + MAIL_NOTIFICATION_OPTIONS.reject {|option| option.first == 'selected'} else MAIL_NOTIFICATION_OPTIONS end @@ -418,7 +422,12 @@ class User < Principal when 'all' true when 'selected' - # Handled by the Project + # user receives notifications for created/assigned issues on unselected projects + if object.is_a?(Issue) && (object.author == self || object.assigned_to == self) + true + else + false + end when 'none' false when 'only_my_events' diff --git a/app/views/issues/_relations.rhtml b/app/views/issues/_relations.rhtml index 5b27fa6a..f8535b82 100644 --- a/app/views/issues/_relations.rhtml +++ b/app/views/issues/_relations.rhtml @@ -6,9 +6,9 @@
<%=l(:label_related_issues)%>
-<% if @issue.relations.any? %> +<% if @relations.present? %><%= l(relation.label_for(@issue)) %> <%= "(#{l('datetime.distance_in_words.x_days', :count => relation.delay)})" if relation.delay && relation.delay != 0 %>
<%= h(relation.other_issue(@issue).project) + ' - ' if Setting.cross_project_issue_relations? %>
diff --git a/app/views/issues/show.api.rsb b/app/views/issues/show.api.rsb
index a6461ff8..170aeb37 100644
--- a/app/views/issues/show.api.rsb
+++ b/app/views/issues/show.api.rsb
@@ -26,10 +26,10 @@ api.issue do
render_api_issue_children(@issue, api) if include_in_api_response?('children')
api.array :relations do
- @issue.relations.select {|r| r.other_issue(@issue).visible? }.each do |relation|
+ @relations.each do |relation|
api.relation(:id => relation.id, :issue_id => relation.other_issue(@issue).id, :relation_type => relation.relation_type_for(@issue), :delay => relation.delay)
end
- end if include_in_api_response?('relations')
+ end if include_in_api_response?('relations') && @relations.present?
api.array :changesets do
@issue.changesets.each do |changeset|
diff --git a/app/views/layouts/base.rhtml b/app/views/layouts/base.rhtml
index 9a80f24b..b59f1e28 100644
--- a/app/views/layouts/base.rhtml
+++ b/app/views/layouts/base.rhtml
@@ -11,7 +11,7 @@
<%= javascript_include_tag :defaults %>
<%= heads_for_theme %>
<%= heads_for_wiki_formatter %>
- Message #{message_id} processed and deleted from the server"
+ logger.debug "--> Message #{message_id} processed and deleted from the server" if logger && logger.debug?
else
if delete_unprocessed
msg.delete
- puts "--> Message #{message_id} NOT processed and deleted from the server"
+ logger.debug "--> Message #{message_id} NOT processed and deleted from the server" if logger && logger.debug?
else
- puts "--> Message #{message_id} NOT processed and left on the server"
+ logger.debug "--> Message #{message_id} NOT processed and left on the server" if logger && logger.debug?
end
end
end
end
end
end
+
+ private
+
+ def logger
+ RAILS_DEFAULT_LOGGER
+ end
end
end
end
diff --git a/lib/redmine/scm/adapters/bazaar_adapter.rb b/lib/redmine/scm/adapters/bazaar_adapter.rb
index a04c3491..96ec8693 100644
--- a/lib/redmine/scm/adapters/bazaar_adapter.rb
+++ b/lib/redmine/scm/adapters/bazaar_adapter.rb
@@ -23,7 +23,7 @@ module Redmine
class BazaarAdapter < AbstractAdapter
# Bazaar executable name
- BZR_BIN = "bzr"
+ BZR_BIN = Redmine::Configuration['scm_bazaar_command'] || "bzr"
# Get info about the repository
def info
diff --git a/lib/redmine/scm/adapters/cvs_adapter.rb b/lib/redmine/scm/adapters/cvs_adapter.rb
index 5ca9e741..5c81e639 100644
--- a/lib/redmine/scm/adapters/cvs_adapter.rb
+++ b/lib/redmine/scm/adapters/cvs_adapter.rb
@@ -23,7 +23,7 @@ module Redmine
class CvsAdapter < AbstractAdapter
# CVS executable name
- CVS_BIN = "cvs"
+ CVS_BIN = Redmine::Configuration['scm_cvs_command'] || "cvs"
# Guidelines for the input:
# url -> the project-path, relative to the cvsroot (eg. module name)
@@ -109,7 +109,7 @@ module Redmine
path_with_project="#{url}#{with_leading_slash(path)}"
cmd = "#{CVS_BIN} -d #{shell_quote root_url} rlog"
- cmd << " -d\">#{time_to_cvstime(identifier_from)}\"" if identifier_from
+ cmd << " -d\">#{time_to_cvstime_rlog(identifier_from)}\"" if identifier_from
cmd << " #{shell_quote path_with_project}"
shellout(cmd) do |io|
state="entry_start"
@@ -290,6 +290,12 @@ module Redmine
end
return time.strftime("%Y-%m-%d %H:%M:%S")
end
+
+ def time_to_cvstime_rlog(time)
+ return nil if time.nil?
+ t1 = time.clone.localtime
+ return t1.strftime("%Y-%m-%d %H:%M:%S")
+ end
def normalize_cvs_path(path)
normalize_path(path.gsub(/Attic\//,''))
diff --git a/lib/redmine/scm/adapters/darcs_adapter.rb b/lib/redmine/scm/adapters/darcs_adapter.rb
index ecc69a4e..4eaf4fff 100644
--- a/lib/redmine/scm/adapters/darcs_adapter.rb
+++ b/lib/redmine/scm/adapters/darcs_adapter.rb
@@ -23,7 +23,7 @@ module Redmine
module Adapters
class DarcsAdapter < AbstractAdapter
# Darcs executable name
- DARCS_BIN = "darcs"
+ DARCS_BIN = Redmine::Configuration['scm_darcs_command'] || "darcs"
class << self
def client_version
@@ -31,16 +31,14 @@ module Redmine
end
def darcs_binary_version
- cmd = "#{DARCS_BIN} --version"
- version = nil
- shellout(cmd) do |io|
- # Read darcs version in first returned line
- if m = io.gets.match(%r{((\d+\.)+\d+)})
- version = m[0].scan(%r{\d+}).collect(&:to_i)
- end
+ darcsversion = darcs_binary_version_from_command_line
+ if m = darcsversion.match(%r{\A(.*?)((\d+\.)+\d+)})
+ m[2].scan(%r{\d+}).collect(&:to_i)
end
- return nil if $? && $?.exitstatus != 0
- version
+ end
+
+ def darcs_binary_version_from_command_line
+ shellout("#{DARCS_BIN} --version") { |io| io.read }.to_s
end
end
@@ -64,7 +62,9 @@ module Redmine
# or nil if the given path doesn't exist in the repository
def entries(path=nil, identifier=nil)
path_prefix = (path.blank? ? '' : "#{path}/")
- path = '.' if path.blank?
+ if path.blank?
+ path = ( self.class.client_version_above?([2, 2, 0]) ? @url : '.' )
+ end
entries = Entries.new
cmd = "#{DARCS_BIN} annotate --repodir #{shell_quote @url} --xml-output"
cmd << " --match #{shell_quote("hash #{identifier}")}" if identifier
@@ -167,9 +167,38 @@ module Redmine
})
})
end
+
+ def get_paths_for_patch(hash)
+ paths = get_paths_for_patch_raw(hash)
+ if self.class.client_version_above?([2, 4])
+ orig_paths = paths
+ paths = []
+ add_paths = []
+ add_paths_name = []
+ mod_paths = []
+ other_paths = []
+ orig_paths.each do |path|
+ if path[:action] == 'A'
+ add_paths << path
+ add_paths_name << path[:path]
+ elsif path[:action] == 'M'
+ mod_paths << path
+ else
+ other_paths << path
+ end
+ end
+ add_paths_name.each do |add_path|
+ mod_paths.delete_if { |m| m[:path] == add_path }
+ end
+ paths.concat add_paths
+ paths.concat mod_paths
+ paths.concat other_paths
+ end
+ paths
+ end
# Retrieve changed paths for a single patch
- def get_paths_for_patch(hash)
+ def get_paths_for_patch_raw(hash)
cmd = "#{DARCS_BIN} annotate --repodir #{shell_quote @url} --summary --xml-output"
cmd << " --match #{shell_quote("hash #{hash}")} "
paths = []
diff --git a/lib/redmine/scm/adapters/git_adapter.rb b/lib/redmine/scm/adapters/git_adapter.rb
index 302ded58..a40f4507 100644
--- a/lib/redmine/scm/adapters/git_adapter.rb
+++ b/lib/redmine/scm/adapters/git_adapter.rb
@@ -22,7 +22,7 @@ module Redmine
module Adapters
class GitAdapter < AbstractAdapter
# Git executable name
- GIT_BIN = "git"
+ GIT_BIN = Redmine::Configuration['scm_git_command'] || "git"
def info
begin
diff --git a/lib/redmine/scm/adapters/mercurial_adapter.rb b/lib/redmine/scm/adapters/mercurial_adapter.rb
index bbc4a2d6..f64e70b2 100644
--- a/lib/redmine/scm/adapters/mercurial_adapter.rb
+++ b/lib/redmine/scm/adapters/mercurial_adapter.rb
@@ -24,7 +24,7 @@ module Redmine
class MercurialAdapter < AbstractAdapter
# Mercurial executable name
- HG_BIN = "hg"
+ HG_BIN = Redmine::Configuration['scm_mercurial_command'] || "hg"
TEMPLATES_DIR = File.dirname(__FILE__) + "/mercurial"
TEMPLATE_NAME = "hg-template"
TEMPLATE_EXTENSION = "tmpl"
diff --git a/lib/redmine/scm/adapters/subversion_adapter.rb b/lib/redmine/scm/adapters/subversion_adapter.rb
index b4702cc2..28ea55e2 100644
--- a/lib/redmine/scm/adapters/subversion_adapter.rb
+++ b/lib/redmine/scm/adapters/subversion_adapter.rb
@@ -24,7 +24,7 @@ module Redmine
class SubversionAdapter < AbstractAdapter
# SVN executable name
- SVN_BIN = "svn"
+ SVN_BIN = Redmine::Configuration['scm_subversion_command'] || "svn"
class << self
def client_version
diff --git a/lib/redmine/version.rb b/lib/redmine/version.rb
index 8d786afb..9520d95c 100644
--- a/lib/redmine/version.rb
+++ b/lib/redmine/version.rb
@@ -4,7 +4,7 @@ module Redmine
module VERSION #:nodoc:
MAJOR = 1
MINOR = 1
- TINY = 0
+ TINY = 1
# Branch values:
# * official release: nil
diff --git a/lib/tasks/migrate_from_mantis.rake b/lib/tasks/migrate_from_mantis.rake
index cd82872c..c45ce68e 100644
--- a/lib/tasks/migrate_from_mantis.rake
+++ b/lib/tasks/migrate_from_mantis.rake
@@ -287,7 +287,7 @@ task :migrate_from_mantis => :environment do
project.versions.each do |version|
v = Version.new :name => encode(version.version),
:description => encode(version.description),
- :effective_date => version.date_order.to_date
+ :effective_date => (version.date_order ? version.date_order.to_date : nil)
v.project = p
v.save
versions_map[version.id] = v.id
diff --git a/public/help/wiki_syntax_detailed.html b/public/help/wiki_syntax_detailed.html
index a1af336a..0c9cea34 100644
--- a/public/help/wiki_syntax_detailed.html
+++ b/public/help/wiki_syntax_detailed.html
@@ -46,7 +46,9 @@
Wiki links: @@ -74,7 +76,7 @@#{result} ", textilizable(text), "#{text} failed" } end + + def test_cross_project_redmine_links + source_link = link_to('ecookbook:source:/some/file', {:controller => 'repositories', :action => 'entry', :id => 'ecookbook', :path => ['some', 'file']}, + :class => 'source') + + changeset_link = link_to('ecookbook:r2', {:controller => 'repositories', :action => 'revision', :id => 'ecookbook', :rev => 2}, + :class => 'changeset', :title => 'This commit fixes #1, #2 and references #1 & #3') + + to_test = { + # documents + 'document:"Test document"' => 'document:"Test document"', + 'ecookbook:document:"Test document"' => 'Test document', + 'invalid:document:"Test document"' => 'invalid:document:"Test document"', + # versions + 'version:"1.0"' => 'version:"1.0"', + 'ecookbook:version:"1.0"' => '1.0', + 'invalid:version:"1.0"' => 'invalid:version:"1.0"', + # changeset + 'r2' => 'r2', + 'ecookbook:r2' => changeset_link, + 'invalid:r2' => 'invalid:r2', + # source + 'source:/some/file' => 'source:/some/file', + 'ecookbook:source:/some/file' => source_link, + 'invalid:source:/some/file' => 'invalid:source:/some/file', + } + @project = Project.find(3) + to_test.each { |text, result| assert_equal "#{result} ", textilizable(text), "#{text} failed" } + end def test_redmine_links_git_commit changeset_link = link_to('abcd', diff --git a/test/unit/issue_nested_set_test.rb b/test/unit/issue_nested_set_test.rb index df9adbe3..cf61cfde 100644 --- a/test/unit/issue_nested_set_test.rb +++ b/test/unit/issue_nested_set_test.rb @@ -202,7 +202,19 @@ class IssueNestedSetTest < ActiveSupport::TestCase issue2 = create_issue! issue3 = create_issue!(:parent_issue_id => issue2.id) issue4 = create_issue!(:parent_issue_id => issue1.id) - issue2.reload.destroy + + issue3.init_journal(User.find(2)) + issue3.subject = 'child with journal' + issue3.save! + + assert_difference 'Issue.count', -2 do + assert_difference 'Journal.count', -1 do + assert_difference 'JournalDetail.count', -1 do + Issue.find(issue2.id).destroy + end + end + end + issue1.reload issue4.reload assert !Issue.exists?(issue2.id) @@ -211,6 +223,26 @@ class IssueNestedSetTest < ActiveSupport::TestCase assert_equal [issue1.id, 2, 3], [issue4.root_id, issue4.lft, issue4.rgt] end + def test_destroy_child_issue_with_children + root = Issue.create!(:project_id => 1, :author_id => 2, :tracker_id => 1, :subject => 'root') + child = Issue.create!(:project_id => 1, :author_id => 2, :tracker_id => 1, :subject => 'child', :parent_issue_id => root.id) + leaf = Issue.create!(:project_id => 1, :author_id => 2, :tracker_id => 1, :subject => 'leaf', :parent_issue_id => child.id) + leaf.init_journal(User.find(2)) + leaf.subject = 'leaf with journal' + leaf.save! + + assert_difference 'Issue.count', -2 do + assert_difference 'Journal.count', -1 do + assert_difference 'JournalDetail.count', -1 do + Issue.find(child.id).destroy + end + end + end + + root = Issue.find(root.id) + assert root.leaf?, "Root issue is not a leaf (lft: #{root.lft}, rgt: #{root.rgt})" + end + def test_parent_priority_should_be_the_highest_child_priority parent = create_issue!(:priority => IssuePriority.find_by_name('Normal')) # Create children diff --git a/test/unit/lib/redmine/configuration_test.rb b/test/unit/lib/redmine/configuration_test.rb new file mode 100644 index 00000000..239f2d3d --- /dev/null +++ b/test/unit/lib/redmine/configuration_test.rb @@ -0,0 +1,52 @@ +# Redmine - project management software +# Copyright (C) 2006-2011 Jean-Philippe Lang +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +require File.expand_path('../../../../test_helper', __FILE__) + +class Redmine::ConfigurationTest < ActiveSupport::TestCase + def setup + @conf = Redmine::Configuration + end + + def test_empty + assert_kind_of Hash, load_conf('empty.yml', 'test') + end + + def test_default + assert_kind_of Hash, load_conf('default.yml', 'test') + assert_equal 'foo', @conf['somesetting'] + end + + def test_no_default + assert_kind_of Hash, load_conf('no_default.yml', 'test') + assert_equal 'foo', @conf['somesetting'] + end + + def test_overrides + assert_kind_of Hash, load_conf('overrides.yml', 'test') + assert_equal 'bar', @conf['somesetting'] + end + + private + + def load_conf(file, env) + @conf.load( + :file => File.join(Rails.root, 'test', 'fixtures', 'configuration', file), + :env => env + ) + end +end diff --git a/test/unit/lib/redmine/scm/adapters/cvs_adapter_test.rb b/test/unit/lib/redmine/scm/adapters/cvs_adapter_test.rb new file mode 100644 index 00000000..e063d44f --- /dev/null +++ b/test/unit/lib/redmine/scm/adapters/cvs_adapter_test.rb @@ -0,0 +1,42 @@ +require File.expand_path('../../../../../../test_helper', __FILE__) +begin + require 'mocha' + + class CvsAdapterTest < ActiveSupport::TestCase + + REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/cvs_repository' + MODULE_NAME = 'test' + + if File.directory?(REPOSITORY_PATH) + def setup + @adapter = Redmine::Scm::Adapters::CvsAdapter.new(MODULE_NAME, REPOSITORY_PATH) + end + + def test_revisions_all + cnt = 0 + @adapter.revisions('', nil, nil, :with_paths => true) do |revision| + cnt += 1 + end + assert_equal 14, cnt + end + + def test_revisions_from_rev3 + rev3_committed_on = Time.gm(2007, 12, 13, 16, 27, 22) + cnt = 0 + @adapter.revisions('', rev3_committed_on, nil, :with_paths => true) do |revision| + cnt += 1 + end + assert_equal 2, cnt + end + else + puts "Cvs test repository NOT FOUND. Skipping unit tests !!!" + def test_fake; assert true end + end + end + +rescue LoadError + class CvsMochaFake < ActiveSupport::TestCase + def test_fake; assert(false, "Requires mocha to run those tests") end + end +end + diff --git a/test/unit/lib/redmine/scm/adapters/darcs_adapter_test.rb b/test/unit/lib/redmine/scm/adapters/darcs_adapter_test.rb new file mode 100644 index 00000000..993b42ca --- /dev/null +++ b/test/unit/lib/redmine/scm/adapters/darcs_adapter_test.rb @@ -0,0 +1,53 @@ +require File.expand_path('../../../../../../test_helper', __FILE__) +begin + require 'mocha' + + class DarcsAdapterTest < ActiveSupport::TestCase + + REPOSITORY_PATH = RAILS_ROOT.gsub(%r{config\/\.\.}, '') + '/tmp/test/darcs_repository' + + if File.directory?(REPOSITORY_PATH) + def setup + @adapter = Redmine::Scm::Adapters::DarcsAdapter.new(REPOSITORY_PATH) + end + + def test_darcsversion + to_test = { "1.0.9 (release)\n" => [1,0,9] , + "2.2.0 (release)\n" => [2,2,0] } + to_test.each do |s, v| + test_darcsversion_for(s, v) + end + end + + def test_revisions + id1 = '20080308225258-98289-761f654d669045eabee90b91b53a21ce5593cadf.gz' + revs = @adapter.revisions('', nil, nil, {:with_path => true}) + assert_equal 6, revs.size + assert_equal id1, revs[5].scmid + paths = revs[5].paths + assert_equal 5, paths.size + assert_equal 'A', paths[0][:action] + assert_equal '/README', paths[0][:path] + assert_equal 'A', paths[1][:action] + assert_equal '/images', paths[1][:path] + end + + private + + def test_darcsversion_for(darcsversion, version) + @adapter.class.expects(:darcs_binary_version_from_command_line).returns(darcsversion) + assert_equal version, @adapter.class.darcs_binary_version + end + + else + puts "Darcs test repository NOT FOUND. Skipping unit tests !!!" + def test_fake; assert true end + end + end + +rescue LoadError + class DarcsMochaFake < ActiveSupport::TestCase + def test_fake; assert(false, "Requires mocha to run those tests") end + end +end + diff --git a/test/unit/lib/redmine/scm/adapters/mercurial_adapter_test.rb b/test/unit/lib/redmine/scm/adapters/mercurial_adapter_test.rb index 65e4a23d..bc82c562 100644 --- a/test/unit/lib/redmine/scm/adapters/mercurial_adapter_test.rb +++ b/test/unit/lib/redmine/scm/adapters/mercurial_adapter_test.rb @@ -69,6 +69,17 @@ begin end end + def test_diff_made_by_revision + if @adapter.class.client_version_above?([1, 2]) + [16, '16', '4cddb4e45f52'].each do |r1| + diff1 = @adapter.diff(nil, r1) + assert_equal 5, diff1.size + buf = diff1[4].gsub(/\r\n|\r|\n/, "") + assert_equal '+0885933ad4f68d77c2649cd11f8311276e7ef7ce tag-init-revision', buf + end + end + end + def test_cat [2, '400bb8672109', '400', 400].each do |r| buf = @adapter.cat('sources/welcome_controller.rb', r) diff --git a/test/unit/repository_cvs_test.rb b/test/unit/repository_cvs_test.rb index 5174f2c2..a5da09f5 100644 --- a/test/unit/repository_cvs_test.rb +++ b/test/unit/repository_cvs_test.rb @@ -27,7 +27,7 @@ class RepositoryCvsTest < ActiveSupport::TestCase MODULE_NAME = 'test' def setup - @project = Project.find(1) + @project = Project.find(3) assert @repository = Repository::Cvs.create(:project => @project, :root_url => REPOSITORY_PATH, :url => MODULE_NAME) @@ -35,26 +35,54 @@ class RepositoryCvsTest < ActiveSupport::TestCase if File.directory?(REPOSITORY_PATH) def test_fetch_changesets_from_scratch + assert_equal 0, @repository.changesets.count @repository.fetch_changesets @repository.reload assert_equal 5, @repository.changesets.count assert_equal 14, @repository.changes.count assert_not_nil @repository.changesets.find_by_comments('Two files changed') + + r2 = @repository.changesets.find_by_revision('2') + assert_equal 'v1-20071213-162510', r2.scmid end def test_fetch_changesets_incremental + assert_equal 0, @repository.changesets.count @repository.fetch_changesets - # Remove the 3 latest changesets - @repository.changesets.find(:all, :order => 'committed_on DESC', :limit => 3).each(&:destroy) + # Remove changesets with revision > 3 + @repository.changesets.find(:all).each {|c| c.destroy if c.revision.to_i > 3} @repository.reload - assert_equal 2, @repository.changesets.count - + assert_equal 3, @repository.changesets.count + assert_equal %w|3 2 1|, @repository.changesets.collect(&:revision) + + rev3_commit = @repository.changesets.find(:first, :order => 'committed_on DESC') + assert_equal '3', rev3_commit.revision + # 2007-12-14 01:27:22 +0900 + rev3_committed_on = Time.gm(2007, 12, 13, 16, 27, 22) + assert_equal 'HEAD-20071213-162722', rev3_commit.scmid + assert_equal rev3_committed_on, rev3_commit.committed_on + latest_rev = @repository.latest_changeset + assert_equal rev3_committed_on, latest_rev.committed_on + @repository.fetch_changesets + @repository.reload assert_equal 5, @repository.changesets.count + + assert_equal %w|5 4 3 2 1|, @repository.changesets.collect(&:revision) + rev5_commit = @repository.changesets.find(:first, :order => 'committed_on DESC') + assert_equal 'HEAD-20071213-163001', rev5_commit.scmid + # 2007-12-14 01:30:01 +0900 + rev5_committed_on = Time.gm(2007, 12, 13, 16, 30, 1) + assert_equal rev5_committed_on, rev5_commit.committed_on end def test_deleted_files_should_not_be_listed + assert_equal 0, @repository.changesets.count + @repository.fetch_changesets + @repository.reload + assert_equal 5, @repository.changesets.count + entries = @repository.entries('sources') assert entries.detect {|e| e.name == 'watchers_controller.rb'} assert_nil entries.detect {|e| e.name == 'welcome_controller.rb'} diff --git a/test/unit/user_test.rb b/test/unit/user_test.rb index 5f1e41a6..9bb1ae62 100644 --- a/test/unit/user_test.rb +++ b/test/unit/user_test.rb @@ -1,5 +1,5 @@ -# redMine - project management software -# Copyright (C) 2006 Jean-Philippe Lang +# Redmine - project management software +# Copyright (C) 2006-2011 Jean-Philippe Lang # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -303,6 +303,19 @@ class UserTest < ActiveSupport::TestCase assert_nil @dlopper.roles_for_project(Project.find(2)).detect {|role| role.member?} end + def test_valid_notification_options + # without memberships + assert_equal 5, User.find(7).valid_notification_options.size + # with memberships + assert_equal 6, User.find(2).valid_notification_options.size + end + + def test_valid_notification_options_class_method + assert_equal 5, User.valid_notification_options.size + assert_equal 5, User.valid_notification_options(User.find(7)).size + assert_equal 6, User.valid_notification_options(User.find(2)).size + end + def test_mail_notification_all @jsmith.mail_notification = 'all' @jsmith.notified_project_ids = [] @@ -455,6 +468,7 @@ class UserTest < ActiveSupport::TestCase should "be false for a user with :only_my_events and isn't an author, creator, or assignee" do @user = User.generate_with_protected!(:mail_notification => 'only_my_events') + Member.create!(:user => @user, :project => @project, :role_ids => [1]) assert ! @user.notify_about?(@issue) end @@ -487,6 +501,22 @@ class UserTest < ActiveSupport::TestCase @assignee.update_attribute(:mail_notification, 'only_owner') assert ! @assignee.notify_about?(@issue) end + + should "be true for a user with :selected and is the author" do + @author.update_attribute(:mail_notification, 'selected') + assert @author.notify_about?(@issue) + end + + should "be true for a user with :selected and is the assignee" do + @assignee.update_attribute(:mail_notification, 'selected') + assert @assignee.notify_about?(@issue) + end + + should "be false for a user with :selected and is not the author or assignee" do + @user = User.generate_with_protected!(:mail_notification => 'selected') + Member.create!(:user => @user, :project => @project, :role_ids => [1]) + assert ! @user.notify_about?(@issue) + end end context "other events" do diff --git a/vendor/gems/coderay-0.9.7/.specification b/vendor/gems/coderay-0.9.7/.specification new file mode 100644 index 00000000..03cf3ec2 --- /dev/null +++ b/vendor/gems/coderay-0.9.7/.specification @@ -0,0 +1,155 @@ +--- !ruby/object:Gem::Specification +name: coderay +version: !ruby/object:Gem::Version + hash: 53 + prerelease: false + segments: + - 0 + - 9 + - 7 + version: 0.9.7 +platform: ruby +authors: +- murphy +autorequire: +bindir: bin +cert_chain: [] + +date: 2011-01-15 00:00:00 +01:00 +default_executable: +dependencies: [] + +description: | + Fast and easy syntax highlighting for selected languages, written in Ruby. + Comes with RedCloth integration and LOC counter. + +email: murphy@rubychan.de +executables: +- coderay +- coderay_stylesheet +extensions: [] + +extra_rdoc_files: +- lib/README +- FOLDERS +files: +- ./lib/coderay/duo.rb +- ./lib/coderay/encoder.rb +- ./lib/coderay/encoders/_map.rb +- ./lib/coderay/encoders/comment_filter.rb +- ./lib/coderay/encoders/count.rb +- ./lib/coderay/encoders/debug.rb +- ./lib/coderay/encoders/div.rb +- ./lib/coderay/encoders/filter.rb +- ./lib/coderay/encoders/html/css.rb +- ./lib/coderay/encoders/html/numerization.rb +- ./lib/coderay/encoders/html/output.rb +- ./lib/coderay/encoders/html.rb +- ./lib/coderay/encoders/json.rb +- ./lib/coderay/encoders/lines_of_code.rb +- ./lib/coderay/encoders/null.rb +- ./lib/coderay/encoders/page.rb +- ./lib/coderay/encoders/span.rb +- ./lib/coderay/encoders/statistic.rb +- ./lib/coderay/encoders/term.rb +- ./lib/coderay/encoders/text.rb +- ./lib/coderay/encoders/token_class_filter.rb +- ./lib/coderay/encoders/xml.rb +- ./lib/coderay/encoders/yaml.rb +- ./lib/coderay/for_redcloth.rb +- ./lib/coderay/helpers/file_type.rb +- ./lib/coderay/helpers/gzip_simple.rb +- ./lib/coderay/helpers/plugin.rb +- ./lib/coderay/helpers/word_list.rb +- ./lib/coderay/scanner.rb +- ./lib/coderay/scanners/_map.rb +- ./lib/coderay/scanners/c.rb +- ./lib/coderay/scanners/cpp.rb +- ./lib/coderay/scanners/css.rb +- ./lib/coderay/scanners/debug.rb +- ./lib/coderay/scanners/delphi.rb +- ./lib/coderay/scanners/diff.rb +- ./lib/coderay/scanners/groovy.rb +- ./lib/coderay/scanners/html.rb +- ./lib/coderay/scanners/java/builtin_types.rb +- ./lib/coderay/scanners/java.rb +- ./lib/coderay/scanners/java_script-0.9.6.rb +- ./lib/coderay/scanners/java_script.rb +- ./lib/coderay/scanners/json.rb +- ./lib/coderay/scanners/nitro_xhtml.rb +- ./lib/coderay/scanners/php.rb +- ./lib/coderay/scanners/plaintext.rb +- ./lib/coderay/scanners/python.rb +- ./lib/coderay/scanners/rhtml.rb +- ./lib/coderay/scanners/ruby/patterns.rb +- ./lib/coderay/scanners/ruby.rb +- ./lib/coderay/scanners/scheme.rb +- ./lib/coderay/scanners/sql.rb +- ./lib/coderay/scanners/xml.rb +- ./lib/coderay/scanners/yaml.rb +- ./lib/coderay/style.rb +- ./lib/coderay/styles/_map.rb +- ./lib/coderay/styles/cycnus.rb +- ./lib/coderay/styles/murphy.rb +- ./lib/coderay/token_classes.rb +- ./lib/coderay/tokens.rb +- ./lib/coderay.rb +- ./Rakefile +- ./test/functional/basic.rb +- ./test/functional/basic.rbc +- ./test/functional/for_redcloth.rb +- ./test/functional/for_redcloth.rbc +- ./test/functional/load_plugin_scanner.rb +- ./test/functional/load_plugin_scanner.rbc +- ./test/functional/suite.rb +- ./test/functional/suite.rbc +- ./test/functional/vhdl.rb +- ./test/functional/vhdl.rbc +- ./test/functional/word_list.rb +- ./test/functional/word_list.rbc +- ./lib/README +- ./LICENSE +- lib/README +- FOLDERS +- bin/coderay +- bin/coderay_stylesheet +has_rdoc: true +homepage: http://coderay.rubychan.de +licenses: [] + +post_install_message: +rdoc_options: +- -SNw2 +- -mlib/README +- -t CodeRay Documentation +require_paths: +- lib +required_ruby_version: !ruby/object:Gem::Requirement + none: false + requirements: + - - ">=" + - !ruby/object:Gem::Version + hash: 51 + segments: + - 1 + - 8 + - 2 + version: 1.8.2 +required_rubygems_version: !ruby/object:Gem::Requirement + none: false + requirements: + - - ">=" + - !ruby/object:Gem::Version + hash: 3 + segments: + - 0 + version: "0" +requirements: [] + +rubyforge_project: coderay +rubygems_version: 1.3.7 +signing_key: +specification_version: 3 +summary: Fast syntax highlighting for selected languages. +test_files: +- ./test/functional/suite.rb diff --git a/vendor/gems/coderay-0.9.7/FOLDERS b/vendor/gems/coderay-0.9.7/FOLDERS new file mode 100644 index 00000000..654df137 --- /dev/null +++ b/vendor/gems/coderay-0.9.7/FOLDERS @@ -0,0 +1,53 @@ += CodeRay - Trunk folder structure + +== bench - Benchmarking system + +All benchmarking stuff goes here. + +Test inputs are stored in files namedexample. .
+Test outputs go to bench/test. .
+
+Run bench/bench.rb to get a usage description.
+
+Run rake bench to perform an example benchmark.
+
+
+== bin - Scripts
+
+Executional files for CodeRay.
+
+
+== demo - Demos and functional tests
+
+Demonstrational scripts to show of CodeRay's features.
+
+Run them as functional tests with rake test:demos .
+
+
+== etc - Lots of stuff
+
+Some addidtional files for CodeRay, mainly graphics and Vim scripts.
+
+
+== gem_server - Gem output folder
+
+For rake gem .
+
+
+== lib - CodeRay library code
+
+This is the base directory for the CodeRay library.
+
+
+== rake_helpers - Rake helper libraries
+
+Some files to enhance Rake, including the Autumnal Rdoc template and some scripts.
+
+
+== test - Tests
+
+Tests for the scanners.
+
+Each language has its own subfolder and sub-suite.
+
+Run with rake test .
diff --git a/vendor/plugins/coderay-0.9.2/LICENSE b/vendor/gems/coderay-0.9.7/LICENSE
similarity index 100%
rename from vendor/plugins/coderay-0.9.2/LICENSE
rename to vendor/gems/coderay-0.9.7/LICENSE
diff --git a/vendor/gems/coderay-0.9.7/Rakefile b/vendor/gems/coderay-0.9.7/Rakefile
new file mode 100644
index 00000000..05d0144d
--- /dev/null
+++ b/vendor/gems/coderay-0.9.7/Rakefile
@@ -0,0 +1,35 @@
+require 'rake/rdoctask'
+
+ROOT = '.'
+LIB_ROOT = File.join ROOT, 'lib'
+EXTRA_RDOC_FILES = %w(lib/README FOLDERS)
+
+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
+ desc 'Run CodeRay tests (basic)'
+ task :test do
+ ruby './test/functional/suite.rb'
+ ruby './test/functional/for_redcloth.rb'
+ end
+
+ desc 'Generate documentation for CodeRay'
+ Rake::RDocTask.new :doc do |rd|
+ rd.title = 'CodeRay Documentation'
+ rd.main = 'lib/README'
+ rd.rdoc_files.add Dir['lib']
+ rd.rdoc_files.add 'lib/README'
+ rd.rdoc_files.add 'FOLDERS'
+ rd.rdoc_dir = 'doc'
+ end
+
+end
\ No newline at end of file
diff --git a/vendor/gems/coderay-0.9.7/bin/coderay b/vendor/gems/coderay-0.9.7/bin/coderay
new file mode 100644
index 00000000..62101a83
--- /dev/null
+++ b/vendor/gems/coderay-0.9.7/bin/coderay
@@ -0,0 +1,86 @@
+#!/usr/bin/env ruby
+# CodeRay Executable
+#
+# Version: 0.2
+# Author: murphy
+
+require 'coderay'
+
+if ARGV.empty?
+ $stderr.puts <<-USAGE
+CodeRay #{CodeRay::VERSION} (http://coderay.rubychan.de)
+
+Usage:
+ coderay file [-'
+ @out << ''
end
@opened << type
when :end_line
@@ -289,7 +293,7 @@ module Encoders
raise 'Malformed token stream: Trying to close a line (%p) \
that is not open. Open are: %p.' % [type, @opened[1..-1]]
end
- @out << ' '
+ @out << ''
@opened.pop
end
diff --git a/vendor/plugins/coderay-0.9.2/lib/coderay/encoders/html/css.rb b/vendor/gems/coderay-0.9.7/lib/coderay/encoders/html/css.rb
similarity index 100%
rename from vendor/plugins/coderay-0.9.2/lib/coderay/encoders/html/css.rb
rename to vendor/gems/coderay-0.9.7/lib/coderay/encoders/html/css.rb
diff --git a/vendor/plugins/coderay-0.9.2/lib/coderay/encoders/html/numerization.rb b/vendor/gems/coderay-0.9.7/lib/coderay/encoders/html/numerization.rb
similarity index 98%
rename from vendor/plugins/coderay-0.9.2/lib/coderay/encoders/html/numerization.rb
rename to vendor/gems/coderay-0.9.7/lib/coderay/encoders/html/numerization.rb
index 7058edd8..17e8ddb0 100644
--- a/vendor/plugins/coderay-0.9.2/lib/coderay/encoders/html/numerization.rb
+++ b/vendor/gems/coderay-0.9.7/lib/coderay/encoders/html/numerization.rb
@@ -80,8 +80,8 @@ module Encoders
line_numbers.gsub!(/\n/) { "\n" }
line_numbers_table_tpl = TABLE.apply('LINE_NUMBERS', line_numbers)
- gsub!(/<\/div>\n/) { '' }
- gsub!(/\n/) { "\n" }
+ gsub!("\n", '')
+ gsub!("\n", "\n")
wrap_in! line_numbers_table_tpl
@wrapped_in = :div
diff --git a/vendor/plugins/coderay-0.9.2/lib/coderay/encoders/html/output.rb b/vendor/gems/coderay-0.9.7/lib/coderay/encoders/html/output.rb
similarity index 100%
rename from vendor/plugins/coderay-0.9.2/lib/coderay/encoders/html/output.rb
rename to vendor/gems/coderay-0.9.7/lib/coderay/encoders/html/output.rb
diff --git a/vendor/plugins/coderay-0.9.2/lib/coderay/encoders/json.rb b/vendor/gems/coderay-0.9.7/lib/coderay/encoders/json.rb
similarity index 100%
rename from vendor/plugins/coderay-0.9.2/lib/coderay/encoders/json.rb
rename to vendor/gems/coderay-0.9.7/lib/coderay/encoders/json.rb
diff --git a/vendor/plugins/coderay-0.9.2/lib/coderay/encoders/lines_of_code.rb b/vendor/gems/coderay-0.9.7/lib/coderay/encoders/lines_of_code.rb
similarity index 100%
rename from vendor/plugins/coderay-0.9.2/lib/coderay/encoders/lines_of_code.rb
rename to vendor/gems/coderay-0.9.7/lib/coderay/encoders/lines_of_code.rb
diff --git a/vendor/plugins/coderay-0.9.2/lib/coderay/encoders/null.rb b/vendor/gems/coderay-0.9.7/lib/coderay/encoders/null.rb
similarity index 100%
rename from vendor/plugins/coderay-0.9.2/lib/coderay/encoders/null.rb
rename to vendor/gems/coderay-0.9.7/lib/coderay/encoders/null.rb
diff --git a/vendor/plugins/coderay-0.9.2/lib/coderay/encoders/page.rb b/vendor/gems/coderay-0.9.7/lib/coderay/encoders/page.rb
similarity index 100%
rename from vendor/plugins/coderay-0.9.2/lib/coderay/encoders/page.rb
rename to vendor/gems/coderay-0.9.7/lib/coderay/encoders/page.rb
diff --git a/vendor/plugins/coderay-0.9.2/lib/coderay/encoders/span.rb b/vendor/gems/coderay-0.9.7/lib/coderay/encoders/span.rb
similarity index 100%
rename from vendor/plugins/coderay-0.9.2/lib/coderay/encoders/span.rb
rename to vendor/gems/coderay-0.9.7/lib/coderay/encoders/span.rb
diff --git a/vendor/plugins/coderay-0.9.2/lib/coderay/encoders/statistic.rb b/vendor/gems/coderay-0.9.7/lib/coderay/encoders/statistic.rb
similarity index 100%
rename from vendor/plugins/coderay-0.9.2/lib/coderay/encoders/statistic.rb
rename to vendor/gems/coderay-0.9.7/lib/coderay/encoders/statistic.rb
diff --git a/vendor/plugins/coderay-0.9.2/lib/coderay/encoders/term.rb b/vendor/gems/coderay-0.9.7/lib/coderay/encoders/term.rb
similarity index 100%
rename from vendor/plugins/coderay-0.9.2/lib/coderay/encoders/term.rb
rename to vendor/gems/coderay-0.9.7/lib/coderay/encoders/term.rb
diff --git a/vendor/plugins/coderay-0.9.2/lib/coderay/encoders/text.rb b/vendor/gems/coderay-0.9.7/lib/coderay/encoders/text.rb
similarity index 100%
rename from vendor/plugins/coderay-0.9.2/lib/coderay/encoders/text.rb
rename to vendor/gems/coderay-0.9.7/lib/coderay/encoders/text.rb
diff --git a/vendor/plugins/coderay-0.9.2/lib/coderay/encoders/token_class_filter.rb b/vendor/gems/coderay-0.9.7/lib/coderay/encoders/token_class_filter.rb
similarity index 100%
rename from vendor/plugins/coderay-0.9.2/lib/coderay/encoders/token_class_filter.rb
rename to vendor/gems/coderay-0.9.7/lib/coderay/encoders/token_class_filter.rb
diff --git a/vendor/plugins/coderay-0.9.2/lib/coderay/encoders/xml.rb b/vendor/gems/coderay-0.9.7/lib/coderay/encoders/xml.rb
similarity index 100%
rename from vendor/plugins/coderay-0.9.2/lib/coderay/encoders/xml.rb
rename to vendor/gems/coderay-0.9.7/lib/coderay/encoders/xml.rb
diff --git a/vendor/plugins/coderay-0.9.2/lib/coderay/encoders/yaml.rb b/vendor/gems/coderay-0.9.7/lib/coderay/encoders/yaml.rb
similarity index 100%
rename from vendor/plugins/coderay-0.9.2/lib/coderay/encoders/yaml.rb
rename to vendor/gems/coderay-0.9.7/lib/coderay/encoders/yaml.rb
diff --git a/vendor/plugins/coderay-0.9.2/lib/coderay/for_redcloth.rb b/vendor/gems/coderay-0.9.7/lib/coderay/for_redcloth.rb
similarity index 100%
rename from vendor/plugins/coderay-0.9.2/lib/coderay/for_redcloth.rb
rename to vendor/gems/coderay-0.9.7/lib/coderay/for_redcloth.rb
diff --git a/vendor/plugins/coderay-0.9.2/lib/coderay/helpers/file_type.rb b/vendor/gems/coderay-0.9.7/lib/coderay/helpers/file_type.rb
similarity index 100%
rename from vendor/plugins/coderay-0.9.2/lib/coderay/helpers/file_type.rb
rename to vendor/gems/coderay-0.9.7/lib/coderay/helpers/file_type.rb
diff --git a/vendor/plugins/coderay-0.9.2/lib/coderay/helpers/gzip_simple.rb b/vendor/gems/coderay-0.9.7/lib/coderay/helpers/gzip_simple.rb
similarity index 100%
rename from vendor/plugins/coderay-0.9.2/lib/coderay/helpers/gzip_simple.rb
rename to vendor/gems/coderay-0.9.7/lib/coderay/helpers/gzip_simple.rb
diff --git a/vendor/plugins/coderay-0.9.2/lib/coderay/helpers/plugin.rb b/vendor/gems/coderay-0.9.7/lib/coderay/helpers/plugin.rb
similarity index 100%
rename from vendor/plugins/coderay-0.9.2/lib/coderay/helpers/plugin.rb
rename to vendor/gems/coderay-0.9.7/lib/coderay/helpers/plugin.rb
diff --git a/vendor/plugins/coderay-0.9.2/lib/coderay/helpers/word_list.rb b/vendor/gems/coderay-0.9.7/lib/coderay/helpers/word_list.rb
similarity index 100%
rename from vendor/plugins/coderay-0.9.2/lib/coderay/helpers/word_list.rb
rename to vendor/gems/coderay-0.9.7/lib/coderay/helpers/word_list.rb
diff --git a/vendor/plugins/coderay-0.9.2/lib/coderay/scanner.rb b/vendor/gems/coderay-0.9.7/lib/coderay/scanner.rb
similarity index 90%
rename from vendor/plugins/coderay-0.9.2/lib/coderay/scanner.rb
rename to vendor/gems/coderay-0.9.7/lib/coderay/scanner.rb
index 5460d4e3..b12c865f 100644
--- a/vendor/plugins/coderay-0.9.2/lib/coderay/scanner.rb
+++ b/vendor/gems/coderay-0.9.7/lib/coderay/scanner.rb
@@ -68,15 +68,16 @@ module CodeRay
def normify code
code = code.to_s
- if code.respond_to? :force_encoding
- debug, $DEBUG = $DEBUG, false
- begin
- code.force_encoding 'utf-8'
- code[/\z/] # raises an ArgumentError when code contains a non-UTF-8 char
- rescue ArgumentError
- code.force_encoding 'binary'
- ensure
- $DEBUG = debug
+ if code.respond_to?(:encoding) && (code.encoding.name != 'UTF-8' || !code.valid_encoding?)
+ code = code.dup
+ original_encoding = code.encoding
+ code.force_encoding 'Windows-1252'
+ unless code.valid_encoding?
+ code.force_encoding original_encoding
+ if code.encoding.name == 'UTF-8'
+ code.encode! 'UTF-16BE', :invalid => :replace, :undef => :replace, :replace => '?'
+ end
+ code.encode! 'UTF-8', :invalid => :replace, :undef => :replace, :replace => '?'
end
end
code.to_unix
@@ -147,7 +148,12 @@ module CodeRay
def string= code
code = Scanner.normify(code)
- super code
+ if defined?(RUBY_DESCRIPTION) && RUBY_DESCRIPTION['rubinius 1.0.1']
+ reset_state
+ @string = code
+ else
+ super code
+ end
reset_instance
end
diff --git a/vendor/plugins/coderay-0.9.2/lib/coderay/scanners/_map.rb b/vendor/gems/coderay-0.9.7/lib/coderay/scanners/_map.rb
similarity index 100%
rename from vendor/plugins/coderay-0.9.2/lib/coderay/scanners/_map.rb
rename to vendor/gems/coderay-0.9.7/lib/coderay/scanners/_map.rb
diff --git a/vendor/plugins/coderay-0.9.2/lib/coderay/scanners/c.rb b/vendor/gems/coderay-0.9.7/lib/coderay/scanners/c.rb
similarity index 100%
rename from vendor/plugins/coderay-0.9.2/lib/coderay/scanners/c.rb
rename to vendor/gems/coderay-0.9.7/lib/coderay/scanners/c.rb
diff --git a/vendor/plugins/coderay-0.9.2/lib/coderay/scanners/cpp.rb b/vendor/gems/coderay-0.9.7/lib/coderay/scanners/cpp.rb
similarity index 100%
rename from vendor/plugins/coderay-0.9.2/lib/coderay/scanners/cpp.rb
rename to vendor/gems/coderay-0.9.7/lib/coderay/scanners/cpp.rb
diff --git a/vendor/plugins/coderay-0.9.2/lib/coderay/scanners/css.rb b/vendor/gems/coderay-0.9.7/lib/coderay/scanners/css.rb
similarity index 97%
rename from vendor/plugins/coderay-0.9.2/lib/coderay/scanners/css.rb
rename to vendor/gems/coderay-0.9.7/lib/coderay/scanners/css.rb
index 5f461453..08ecbb18 100644
--- a/vendor/plugins/coderay-0.9.2/lib/coderay/scanners/css.rb
+++ b/vendor/gems/coderay-0.9.7/lib/coderay/scanners/css.rb
@@ -14,12 +14,11 @@ module Scanners
]
module RE
- NonASCII = /[\x80-\xFF]/
Hex = /[0-9a-fA-F]/
Unicode = /\\#{Hex}{1,6}(?:\r\n|\s)?/ # differs from standard because it allows uppercase hex too
Escape = /#{Unicode}|\\[^\r\n\f0-9a-fA-F]/
- NMChar = /[-_a-zA-Z0-9]|#{NonASCII}|#{Escape}/
- NMStart = /[_a-zA-Z]|#{NonASCII}|#{Escape}/
+ NMChar = /[-_a-zA-Z0-9]|#{Escape}/
+ NMStart = /[_a-zA-Z]|#{Escape}/
NL = /\r\n|\r|\n|\f/
String1 = /"(?:[^\n\r\f\\"]|\\#{NL}|#{Escape})*"?/ # FIXME: buggy regexp
String2 = /'(?:[^\n\r\f\\']|\\#{NL}|#{Escape})*'?/ # FIXME: buggy regexp
diff --git a/vendor/plugins/coderay-0.9.2/lib/coderay/scanners/debug.rb b/vendor/gems/coderay-0.9.7/lib/coderay/scanners/debug.rb
similarity index 100%
rename from vendor/plugins/coderay-0.9.2/lib/coderay/scanners/debug.rb
rename to vendor/gems/coderay-0.9.7/lib/coderay/scanners/debug.rb
diff --git a/vendor/plugins/coderay-0.9.2/lib/coderay/scanners/delphi.rb b/vendor/gems/coderay-0.9.7/lib/coderay/scanners/delphi.rb
similarity index 100%
rename from vendor/plugins/coderay-0.9.2/lib/coderay/scanners/delphi.rb
rename to vendor/gems/coderay-0.9.7/lib/coderay/scanners/delphi.rb
diff --git a/vendor/plugins/coderay-0.9.2/lib/coderay/scanners/diff.rb b/vendor/gems/coderay-0.9.7/lib/coderay/scanners/diff.rb
similarity index 85%
rename from vendor/plugins/coderay-0.9.2/lib/coderay/scanners/diff.rb
rename to vendor/gems/coderay-0.9.7/lib/coderay/scanners/diff.rb
index 0a3b6b34..353b9669 100644
--- a/vendor/plugins/coderay-0.9.2/lib/coderay/scanners/diff.rb
+++ b/vendor/gems/coderay-0.9.7/lib/coderay/scanners/diff.rb
@@ -47,11 +47,16 @@ module Scanners
tokens << [match, :change]
next unless match = scan(/.+/)
kind = :plain
- elsif scan(/(@@)((?>[^@\n]*))(@@)/)
- tokens << [:begin_line, line_kind = :change]
- tokens << [self[1], :change]
- tokens << [self[2], :plain]
- tokens << [self[3], :change]
+ elsif match = scan(/@@(?>[^@\n]*)@@/)
+ if check(/\n|$/)
+ tokens << [:begin_line, line_kind = :change]
+ else
+ tokens << [:open, :change]
+ end
+ tokens << [match[0,2], :change]
+ tokens << [match[2...-2], :plain]
+ tokens << [match[-2,2], :change]
+ tokens << [:close, :change] unless line_kind
next unless match = scan(/.+/)
kind = :plain
elsif match = scan(/\+/)
@@ -67,7 +72,7 @@ module Scanners
elsif scan(/ .*/)
kind = :comment
elsif scan(/.+/)
- tokens << [:begin_line, line_kind = :head]
+ tokens << [:begin_line, line_kind = :comment]
kind = :plain
else
raise_inspect 'else case rached'
diff --git a/vendor/plugins/coderay-0.9.2/lib/coderay/scanners/groovy.rb b/vendor/gems/coderay-0.9.7/lib/coderay/scanners/groovy.rb
similarity index 100%
rename from vendor/plugins/coderay-0.9.2/lib/coderay/scanners/groovy.rb
rename to vendor/gems/coderay-0.9.7/lib/coderay/scanners/groovy.rb
diff --git a/vendor/plugins/coderay-0.9.2/lib/coderay/scanners/html.rb b/vendor/gems/coderay-0.9.7/lib/coderay/scanners/html.rb
similarity index 99%
rename from vendor/plugins/coderay-0.9.2/lib/coderay/scanners/html.rb
rename to vendor/gems/coderay-0.9.7/lib/coderay/scanners/html.rb
index 5cb11042..009a461d 100644
--- a/vendor/plugins/coderay-0.9.2/lib/coderay/scanners/html.rb
+++ b/vendor/gems/coderay-0.9.7/lib/coderay/scanners/html.rb
@@ -91,7 +91,7 @@ module Scanners
end
when :attribute
- if scan(/#{TAG_END}/)
+ if scan(/#{TAG_END}/o)
kind = :tag
state = :initial
elsif scan(/#{ATTR_NAME}/o)
diff --git a/vendor/plugins/coderay-0.9.2/lib/coderay/scanners/java.rb b/vendor/gems/coderay-0.9.7/lib/coderay/scanners/java.rb
similarity index 99%
rename from vendor/plugins/coderay-0.9.2/lib/coderay/scanners/java.rb
rename to vendor/gems/coderay-0.9.7/lib/coderay/scanners/java.rb
index 0d218fbe..caf36199 100644
--- a/vendor/plugins/coderay-0.9.2/lib/coderay/scanners/java.rb
+++ b/vendor/gems/coderay-0.9.7/lib/coderay/scanners/java.rb
@@ -138,7 +138,7 @@ module Scanners
elsif scan(/\\./m)
kind = :content
elsif scan(/ \\ | $ /x)
- tokens << [:close, :delimiter]
+ tokens << [:close, state]
kind = :error
state = :initial
else
diff --git a/vendor/plugins/coderay-0.9.2/lib/coderay/scanners/java/builtin_types.rb b/vendor/gems/coderay-0.9.7/lib/coderay/scanners/java/builtin_types.rb
similarity index 100%
rename from vendor/plugins/coderay-0.9.2/lib/coderay/scanners/java/builtin_types.rb
rename to vendor/gems/coderay-0.9.7/lib/coderay/scanners/java/builtin_types.rb
diff --git a/vendor/gems/coderay-0.9.7/lib/coderay/scanners/java_script-0.9.6.rb b/vendor/gems/coderay-0.9.7/lib/coderay/scanners/java_script-0.9.6.rb
new file mode 100644
index 00000000..cb49b7af
--- /dev/null
+++ b/vendor/gems/coderay-0.9.7/lib/coderay/scanners/java_script-0.9.6.rb
@@ -0,0 +1,224 @@
+module CodeRay
+module Scanners
+
+ class JavaScript < Scanner
+
+ include Streamable
+
+ 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
+ ]
+ PREDEFINED_CONSTANTS = %w[
+ false null true undefined
+ ]
+
+ MAGIC_VARIABLES = %w[ this arguments ] # arguments was introduced in JavaScript 1.4
+
+ KEYWORDS_EXPECTING_VALUE = WordList.new.add %w[
+ case delete in instanceof new return throw typeof with
+ ]
+
+ # 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
+ ]
+
+ IDENT_KIND = WordList.new(:ident).
+ add(RESERVED_WORDS, :reserved).
+ add(PREDEFINED_CONSTANTS, :pre_constant).
+ add(MAGIC_VARIABLES, :local_variable).
+ add(KEYWORDS, :keyword)
+
+ ESCAPE = / [bfnrtv\n\\'"] | x[a-fA-F0-9]{1,2} | [0-7]{1,3} /x
+ UNICODE_ESCAPE = / u[a-fA-F0-9]{4} | U[a-fA-F0-9]{8} /x
+ REGEXP_ESCAPE = / [bBdDsSwW] /x
+ STRING_CONTENT_PATTERN = {
+ "'" => /[^\\']+/,
+ '"' => /[^\\"]+/,
+ '/' => /[^\\\/]+/,
+ }
+ KEY_CHECK_PATTERN = {
+ "'" => / [^\\']* (?: \\.? [^\\']* )* '? \s* : /x,
+ '"' => / [^\\"]* (?: \\.? [^\\"]* )* "? \s* : /x,
+ }
+
+ def scan_tokens tokens, options
+
+ state = :initial
+ string_delimiter = nil
+ value_expected = true
+ key_expected = false
+ function_expected = false
+
+ until eos?
+
+ kind = nil
+ match = nil
+
+ case state
+
+ when :initial
+
+ if match = scan(/ \s+ | \\\n /x)
+ value_expected = true if !value_expected && match.index(?\n)
+ tokens << [match, :space]
+ next
+
+ elsif scan(%r! // [^\n\\]* (?: \\. [^\n\\]* )* | /\* (?: .*? \*/ | .* ) !mx)
+ value_expected = true
+ kind = :comment
+
+ elsif check(/\.?\d/)
+ key_expected = value_expected = false
+ if scan(/0[xX][0-9A-Fa-f]+/)
+ kind = :hex
+ elsif scan(/(?>0[0-7]+)(?![89.eEfF])/)
+ kind = :oct
+ elsif scan(/\d+[fF]|\d*\.\d+(?:[eE][+-]?\d+)?[fF]?|\d+[eE][+-]?\d+[fF]?/)
+ kind = :float
+ elsif scan(/\d+/)
+ kind = :integer
+ end
+
+ elsif value_expected && match = scan(/<([[:alpha:]]\w*) (?: [^\/>]*\/> | .*?<\/\1>)/xim)
+ # FIXME: scan over nested tags
+ xml_scanner.tokenize match
+ 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
+ kind = :operator
+
+ elsif scan(/ [)\]}]+ /x)
+ function_expected = key_expected = value_expected = false
+ kind = :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
+
+ elsif match = scan(/["']/)
+ if key_expected && check(KEY_CHECK_PATTERN[match])
+ state = :key
+ else
+ state = :string
+ end
+ tokens << [:open, state]
+ string_delimiter = match
+ kind = :delimiter
+
+ elsif value_expected && (match = scan(/\/(?=\S)/))
+ tokens << [:open, :regexp]
+ state = :regexp
+ string_delimiter = '/'
+ kind = :delimiter
+
+ elsif scan(/ \/ /x)
+ value_expected = true
+ key_expected = false
+ kind = :operator
+
+ else
+ getch
+ kind = :error
+
+ end
+
+ when :string, :regexp, :key
+ if scan(STRING_CONTENT_PATTERN[string_delimiter])
+ kind = :content
+ elsif match = scan(/["'\/]/)
+ tokens << [match, :delimiter]
+ if state == :regexp
+ modifiers = scan(/[gim]+/)
+ tokens << [modifiers, :modifier] if modifiers && !modifiers.empty?
+ end
+ tokens << [:close, state]
+ string_delimiter = nil
+ key_expected = value_expected = false
+ state = :initial
+ next
+ elsif state != :regexp && (match = scan(/ \\ (?: #{ESCAPE} | #{UNICODE_ESCAPE} ) /mox))
+ if string_delimiter == "'" && !(match == "\\\\" || match == "\\'")
+ kind = :content
+ else
+ kind = :char
+ end
+ elsif state == :regexp && scan(/ \\ (?: #{ESCAPE} | #{REGEXP_ESCAPE} | #{UNICODE_ESCAPE} ) /mox)
+ kind = :char
+ elsif scan(/\\./m)
+ kind = :content
+ elsif scan(/ \\ | $ /x)
+ tokens << [:close, state]
+ kind = :error
+ key_expected = value_expected = false
+ state = :initial
+ else
+ raise_inspect "else case \" reached; %p not handled." % peek(1), tokens
+ end
+
+ else
+ raise_inspect 'Unknown state', tokens
+
+ end
+
+ match ||= matched
+ if $CODERAY_DEBUG and not kind
+ raise_inspect 'Error token %p in line %d' %
+ [[match, kind], line], tokens
+ end
+ raise_inspect 'Empty token', tokens unless match
+
+ tokens << [match, kind]
+
+ end
+
+ if [:string, :regexp].include? state
+ tokens << [:close, state]
+ end
+
+ tokens
+ 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/vendor/plugins/coderay-0.9.2/lib/coderay/scanners/java_script.rb b/vendor/gems/coderay-0.9.7/lib/coderay/scanners/java_script.rb
similarity index 97%
rename from vendor/plugins/coderay-0.9.2/lib/coderay/scanners/java_script.rb
rename to vendor/gems/coderay-0.9.7/lib/coderay/scanners/java_script.rb
index e2f9a582..1f26348b 100644
--- a/vendor/plugins/coderay-0.9.2/lib/coderay/scanners/java_script.rb
+++ b/vendor/gems/coderay-0.9.7/lib/coderay/scanners/java_script.rb
@@ -47,8 +47,8 @@ module Scanners
'/' => /[^\\\/]+/,
}
KEY_CHECK_PATTERN = {
- "'" => / [^\\']* (?: \\.? [^\\']* )* '? \s* : /x,
- '"' => / [^\\"]* (?: \\.? [^\\"]* )* "? \s* : /x,
+ "'" => / (?> [^\\']* (?: \\. [^\\']* )* ) ' \s* : /mx,
+ '"' => / (?> [^\\"]* (?: \\. [^\\"]* )* ) " \s* : /mx,
}
def scan_tokens tokens, options
@@ -215,7 +215,7 @@ module Scanners
end
def xml_scanner
- @xml_scanner ||= CodeRay.scanner :xml, :tokens => @tokens, :keep_tokens => true, :keep_state => true
+ @xml_scanner ||= CodeRay.scanner :xml, :tokens => @tokens, :keep_tokens => true, :keep_state => false
end
end
diff --git a/vendor/plugins/coderay-0.9.2/lib/coderay/scanners/json.rb b/vendor/gems/coderay-0.9.7/lib/coderay/scanners/json.rb
similarity index 92%
rename from vendor/plugins/coderay-0.9.2/lib/coderay/scanners/json.rb
rename to vendor/gems/coderay-0.9.7/lib/coderay/scanners/json.rb
index 33dd30f6..abe24fb0 100644
--- a/vendor/plugins/coderay-0.9.2/lib/coderay/scanners/json.rb
+++ b/vendor/gems/coderay-0.9.7/lib/coderay/scanners/json.rb
@@ -13,9 +13,6 @@ module Scanners
:error, :integer, :operator, :value,
]
- CONSTANTS = %w( true false null )
- IDENT_KIND = WordList.new(:key).add(CONSTANTS, :value)
-
ESCAPE = / [bfnrt\\"\/] /x
UNICODE_ESCAPE = / u[a-fA-F0-9]{4} /x
@@ -23,7 +20,6 @@ module Scanners
state = :initial
stack = []
- string_delimiter = nil
key_expected = false
until eos?
@@ -47,7 +43,7 @@ module Scanners
when '}', ']' then stack.pop # no error recovery, but works for valid JSON
end
elsif match = scan(/ true | false | null /x)
- kind = IDENT_KIND[match]
+ kind = :value
elsif match = scan(/-?(?:0|[1-9]\d*)/)
kind = :integer
if scan(/\.\d+(?:[eE][-+]?\d+)?|[eE][-+]?\d+/)
@@ -76,7 +72,7 @@ module Scanners
elsif scan(/\\./m)
kind = :content
elsif scan(/ \\ | $ /x)
- tokens << [:close, :delimiter]
+ tokens << [:close, state]
kind = :error
state = :initial
else
diff --git a/vendor/plugins/coderay-0.9.2/lib/coderay/scanners/nitro_xhtml.rb b/vendor/gems/coderay-0.9.7/lib/coderay/scanners/nitro_xhtml.rb
similarity index 100%
rename from vendor/plugins/coderay-0.9.2/lib/coderay/scanners/nitro_xhtml.rb
rename to vendor/gems/coderay-0.9.7/lib/coderay/scanners/nitro_xhtml.rb
diff --git a/vendor/plugins/coderay-0.9.2/lib/coderay/scanners/php.rb b/vendor/gems/coderay-0.9.7/lib/coderay/scanners/php.rb
similarity index 98%
rename from vendor/plugins/coderay-0.9.2/lib/coderay/scanners/php.rb
rename to vendor/gems/coderay-0.9.7/lib/coderay/scanners/php.rb
index cc3e7bc9..cb93264f 100644
--- a/vendor/plugins/coderay-0.9.2/lib/coderay/scanners/php.rb
+++ b/vendor/gems/coderay-0.9.7/lib/coderay/scanners/php.rb
@@ -225,6 +225,12 @@ module Scanners
end
def scan_tokens tokens, options
+ if string.respond_to?(:encoding)
+ unless string.encoding == Encoding::ASCII_8BIT
+ self.string = string.encode Encoding::ASCII_8BIT,
+ :invalid => :replace, :undef => :replace, :replace => '?'
+ end
+ end
if check(RE::PHP_START) || # starts with
(match?(/\s*<\S/) && exist?(RE::PHP_START)) || # starts with tag and contains
diff --git a/vendor/plugins/coderay-0.9.2/lib/coderay/scanners/plaintext.rb b/vendor/gems/coderay-0.9.7/lib/coderay/scanners/plaintext.rb
similarity index 100%
rename from vendor/plugins/coderay-0.9.2/lib/coderay/scanners/plaintext.rb
rename to vendor/gems/coderay-0.9.7/lib/coderay/scanners/plaintext.rb
diff --git a/vendor/plugins/coderay-0.9.2/lib/coderay/scanners/python.rb b/vendor/gems/coderay-0.9.7/lib/coderay/scanners/python.rb
similarity index 100%
rename from vendor/plugins/coderay-0.9.2/lib/coderay/scanners/python.rb
rename to vendor/gems/coderay-0.9.7/lib/coderay/scanners/python.rb
diff --git a/vendor/plugins/coderay-0.9.2/lib/coderay/scanners/rhtml.rb b/vendor/gems/coderay-0.9.7/lib/coderay/scanners/rhtml.rb
similarity index 88%
rename from vendor/plugins/coderay-0.9.2/lib/coderay/scanners/rhtml.rb
rename to vendor/gems/coderay-0.9.7/lib/coderay/scanners/rhtml.rb
index 581f1f80..378d0786 100644
--- a/vendor/plugins/coderay-0.9.2/lib/coderay/scanners/rhtml.rb
+++ b/vendor/gems/coderay-0.9.7/lib/coderay/scanners/rhtml.rb
@@ -49,12 +49,16 @@ module Scanners
@html_scanner.tokenize match
elsif match = scan(/#{ERB_RUBY_BLOCK}/o)
- start_tag = match[/\A<%[-=]?/]
+ start_tag = match[/\A<%[-=#]?/]
end_tag = match[/-?%?>?\z/]
tokens << [:open, :inline]
tokens << [start_tag, :inline_delimiter]
code = match[start_tag.size .. -1 - end_tag.size]
- @ruby_scanner.tokenize code
+ if start_tag == '<%#'
+ tokens << [code, :comment]
+ else
+ @ruby_scanner.tokenize code
+ end
tokens << [end_tag, :inline_delimiter] unless end_tag.empty?
tokens << [:close, :inline]
diff --git a/vendor/plugins/coderay-0.9.2/lib/coderay/scanners/ruby.rb b/vendor/gems/coderay-0.9.7/lib/coderay/scanners/ruby.rb
similarity index 81%
rename from vendor/plugins/coderay-0.9.2/lib/coderay/scanners/ruby.rb
rename to vendor/gems/coderay-0.9.7/lib/coderay/scanners/ruby.rb
index 8512678c..3cadc64d 100644
--- a/vendor/plugins/coderay-0.9.2/lib/coderay/scanners/ruby.rb
+++ b/vendor/gems/coderay-0.9.7/lib/coderay/scanners/ruby.rb
@@ -1,3 +1,4 @@
+# encoding: utf-8
module CodeRay
module Scanners
@@ -28,6 +29,16 @@ module Scanners
private
def scan_tokens tokens, options
+ if string.respond_to?(:encoding)
+ unless string.encoding == Encoding::UTF_8
+ self.string = string.encode Encoding::UTF_8,
+ :invalid => :replace, :undef => :replace, :replace => '?'
+ end
+ unicode = false
+ else
+ unicode = exist?(/[^\x00-\x7f]/)
+ end
+
last_token_dot = false
value_expected = true
heredocs = nil
@@ -35,7 +46,7 @@ module Scanners
state = :initial
depth = nil
inline_block_stack = []
- unicode = string.respond_to?(:encoding) && string.encoding.name == 'UTF-8'
+
patterns = Patterns # avoid constant lookup
@@ -170,19 +181,28 @@ module Scanners
if last_token_dot
kind = if match[/^[A-Z]/] and not match?(/\(/) then :constant else :ident end
else
- kind = patterns::IDENT_KIND[match]
- if kind == :ident and match[/^[A-Z]/] and not match[/[!?]$/] and not match?(/\(/)
- kind = :constant
- elsif kind == :reserved
- state = patterns::DEF_NEW_STATE[match]
- value_expected = :set if patterns::KEYWORDS_EXPECTING_VALUE[match]
+ if value_expected != :expect_colon && scan(/:(?= )/)
+ tokens << [match, :key]
+ match = ':'
+ kind = :operator
+ else
+ kind = patterns::IDENT_KIND[match]
+ if kind == :ident
+ if match[/\A[A-Z]/] and not match[/[!?]$/] and not match?(/\(/)
+ kind = :constant
+ end
+ elsif kind == :reserved
+ state = patterns::DEF_NEW_STATE[match]
+ value_expected = :set if patterns::KEYWORDS_EXPECTING_VALUE[match]
+ end
end
end
value_expected = :set if check(/#{patterns::VALUE_FOLLOWS}/o)
elsif last_token_dot and match = scan(/#{patterns::METHOD_NAME_OPERATOR}|\(/o)
kind = :ident
- value_expected = :set if check(/#{patterns::VALUE_FOLLOWS}/o)
+ value_expected = :set if check(unicode ? /#{patterns::VALUE_FOLLOWS}/uo :
+ /#{patterns::VALUE_FOLLOWS}/o)
# OPERATORS #
elsif not last_token_dot and match = scan(/ \.\.\.? | (?:\.|::)() | [,\(\)\[\]\{\}] | ==?=? /x)
@@ -212,7 +232,8 @@ module Scanners
kind = :delimiter
state = patterns::StringState.new :string, match == '"', match # important for streaming
- elsif match = scan(/#{patterns::INSTANCE_VARIABLE}/o)
+ elsif match = scan(unicode ? /#{patterns::INSTANCE_VARIABLE}/uo :
+ /#{patterns::INSTANCE_VARIABLE}/o)
kind = :instance_variable
elsif value_expected and match = scan(/\//)
@@ -225,7 +246,8 @@ module Scanners
elsif match = value_expected ? scan(/[-+]?#{patterns::NUMERIC}/o) : scan(/#{patterns::NUMERIC}/o)
kind = self[1] ? :float : :integer
- elsif match = scan(/#{patterns::SYMBOL}/o)
+ elsif match = scan(unicode ? /#{patterns::SYMBOL}/uo :
+ /#{patterns::SYMBOL}/o)
case delim = match[1]
when ?', ?"
tokens << [:open, :symbol]
@@ -237,11 +259,12 @@ module Scanners
kind = :symbol
end
- elsif match = scan(/ [-+!~^]=? | [*|&]{1,2}=? | >>? /x)
+ elsif match = scan(/ -[>=]? | [+!~^]=? | [*|&]{1,2}=? | >>? /x)
value_expected = :set
kind = :operator
- elsif value_expected and match = scan(/#{patterns::HEREDOC_OPEN}/o)
+ elsif value_expected and match = scan(unicode ? /#{patterns::HEREDOC_OPEN}/uo :
+ /#{patterns::HEREDOC_OPEN}/o)
indented = self[1] == '-'
quote = self[3]
delim = self[quote ? 4 : 2]
@@ -261,7 +284,8 @@ module Scanners
state = patterns::StringState.new kind, interpreted, self[2]
kind = :delimiter
- elsif value_expected and match = scan(/#{patterns::CHARACTER}/o)
+ elsif value_expected and match = scan(unicode ? /#{patterns::CHARACTER}/uo :
+ /#{patterns::CHARACTER}/o)
kind = :integer
elsif match = scan(/ [\/%]=? | <(?:<|=>?)? | [?:;] /x)
@@ -277,14 +301,16 @@ module Scanners
state = patterns::StringState.new :shell, true, match
end
- elsif match = scan(/#{patterns::GLOBAL_VARIABLE}/o)
+ elsif match = scan(unicode ? /#{patterns::GLOBAL_VARIABLE}/uo :
+ /#{patterns::GLOBAL_VARIABLE}/o)
kind = :global_variable
- elsif match = scan(/#{patterns::CLASS_VARIABLE}/o)
+ elsif match = scan(unicode ? /#{patterns::CLASS_VARIABLE}/uo :
+ /#{patterns::CLASS_VARIABLE}/o)
kind = :class_variable
else
- if !unicode
+ if !unicode && !string.respond_to?(:encoding)
# check for unicode
debug, $DEBUG = $DEBUG, false
begin
@@ -300,7 +326,7 @@ module Scanners
next if unicode
end
kind = :error
- match = getch
+ match = scan(unicode ? /./mu : /./m)
end
@@ -322,7 +348,8 @@ module Scanners
kind = :operator
else
state = :initial
- if match = scan(/ (?:#{patterns::IDENT}::)* #{patterns::IDENT} /ox)
+ if match = scan(unicode ? /(?:#{patterns::IDENT}::)*#{patterns::IDENT}/uo :
+ /(?:#{patterns::IDENT}::)*#{patterns::IDENT}/o)
kind = :class
else
next
@@ -331,9 +358,11 @@ module Scanners
elsif state == :undef_expected
state = :undef_comma_expected
- if match = scan(/#{patterns::METHOD_NAME_EX}/o)
+ if match = scan(unicode ? /#{patterns::METHOD_NAME_EX}/uo :
+ /#{patterns::METHOD_NAME_EX}/o)
kind = :method
- elsif match = scan(/#{patterns::SYMBOL}/o)
+ elsif match = scan(unicode ? /#{patterns::SYMBOL}/uo :
+ /#{patterns::SYMBOL}/o)
case delim = match[1]
when ?', ?"
tokens << [:open, :symbol]
@@ -375,7 +404,9 @@ module Scanners
# }}}
unless kind == :error
- value_expected = value_expected == :set
+ if value_expected = value_expected == :set
+ value_expected = :expect_colon if match == '?' || match == 'when'
+ end
last_token_dot = last_token_dot == :set
end
diff --git a/vendor/plugins/coderay-0.9.2/lib/coderay/scanners/ruby/patterns.rb b/vendor/gems/coderay-0.9.7/lib/coderay/scanners/ruby/patterns.rb
similarity index 90%
rename from vendor/plugins/coderay-0.9.2/lib/coderay/scanners/ruby/patterns.rb
rename to vendor/gems/coderay-0.9.7/lib/coderay/scanners/ruby/patterns.rb
index 576bedae..ba3ac8a4 100644
--- a/vendor/plugins/coderay-0.9.2/lib/coderay/scanners/ruby/patterns.rb
+++ b/vendor/gems/coderay-0.9.7/lib/coderay/scanners/ruby/patterns.rb
@@ -16,7 +16,7 @@ module Scanners
DEF_KEYWORDS = %w[ def ]
UNDEF_KEYWORDS = %w[ undef ]
ALIAS_KEYWORDS = %w[ alias ]
- MODULE_KEYWORDS = %w[class module]
+ MODULE_KEYWORDS = %w[ class module ]
DEF_NEW_STATE = WordList.new(:initial).
add(DEF_KEYWORDS, :def_expected).
add(UNDEF_KEYWORDS, :undef_expected).
@@ -25,14 +25,26 @@ module Scanners
PREDEFINED_CONSTANTS = %w[
nil true false self
- DATA ARGV ARGF __FILE__ __LINE__
+ DATA ARGV ARGF
+ __FILE__ __LINE__ __ENCODING__
]
IDENT_KIND = WordList.new(:ident).
add(RESERVED_WORDS, :reserved).
add(PREDEFINED_CONSTANTS, :pre_constant)
- IDENT = 'ä'[/[[:alpha:]]/] == 'ä' ? /[[:alpha:]_][[:alnum:]_]*/ : /[^\W\d]\w*/
+ if /\w/u === '∑'
+ # MRI 1.8.6, 1.8.7
+ IDENT = /[^\W\d]\w*/
+ else
+ if //.respond_to? :encoding
+ # MRI 1.9.1, 1.9.2
+ IDENT = Regexp.new '[\p{L}\p{M}\p{Pc}\p{Sm}&&[^\x00-\x40\x5b-\x5e\x60\x7b-\x7f]][\p{L}\p{M}\p{N}\p{Pc}\p{Sm}&&[^\x00-\x2f\x3a-\x40\x5b-\x5e\x60\x7b-\x7f]]*'
+ else
+ # JRuby, Rubinius
+ IDENT = /[^\x00-\x40\x5b-\x5e\x60\x7b-\x7f][^\x00-\x2f\x3a-\x40\x5b-\x5e\x60\x7b-\x7f]*/
+ end
+ end
METHOD_NAME = / #{IDENT} [?!]? /ox
METHOD_NAME_OPERATOR = /
@@ -109,10 +121,12 @@ module Scanners
# NOTE: This is not completely correct, but
# nobody needs heredoc delimiters ending with \n.
+ # Also, delimiters starting with numbers are allowed.
+ # but they are more often than not a false positive.
HEREDOC_OPEN = /
<< (-)? # $1 = float
(?:
- ( [A-Za-z_0-9]+ ) # $2 = delim
+ ( #{IDENT} ) # $2 = delim
|
( ["'`\/] ) # $3 = quote, type
( [^\n]*? ) \3 # $4 = delim
diff --git a/vendor/plugins/coderay-0.9.2/lib/coderay/scanners/scheme.rb b/vendor/gems/coderay-0.9.7/lib/coderay/scanners/scheme.rb
similarity index 100%
rename from vendor/plugins/coderay-0.9.2/lib/coderay/scanners/scheme.rb
rename to vendor/gems/coderay-0.9.7/lib/coderay/scanners/scheme.rb
diff --git a/vendor/plugins/coderay-0.9.2/lib/coderay/scanners/sql.rb b/vendor/gems/coderay-0.9.7/lib/coderay/scanners/sql.rb
similarity index 99%
rename from vendor/plugins/coderay-0.9.2/lib/coderay/scanners/sql.rb
rename to vendor/gems/coderay-0.9.7/lib/coderay/scanners/sql.rb
index 2b21c79d..89075816 100644
--- a/vendor/plugins/coderay-0.9.2/lib/coderay/scanners/sql.rb
+++ b/vendor/gems/coderay-0.9.7/lib/coderay/scanners/sql.rb
@@ -56,7 +56,7 @@ module CodeRay module Scanners
if scan(/ \s+ | \\\n /x)
kind = :space
- elsif scan(/^(?:--\s?|#).*/)
+ elsif scan(/(?:--\s?|#).*/)
kind = :comment
elsif scan(%r! /\* (?: .*? \*/ | .* ) !mx)
diff --git a/vendor/plugins/coderay-0.9.2/lib/coderay/scanners/xml.rb b/vendor/gems/coderay-0.9.7/lib/coderay/scanners/xml.rb
similarity index 100%
rename from vendor/plugins/coderay-0.9.2/lib/coderay/scanners/xml.rb
rename to vendor/gems/coderay-0.9.7/lib/coderay/scanners/xml.rb
diff --git a/vendor/plugins/coderay-0.9.2/lib/coderay/scanners/yaml.rb b/vendor/gems/coderay-0.9.7/lib/coderay/scanners/yaml.rb
similarity index 100%
rename from vendor/plugins/coderay-0.9.2/lib/coderay/scanners/yaml.rb
rename to vendor/gems/coderay-0.9.7/lib/coderay/scanners/yaml.rb
diff --git a/vendor/plugins/coderay-0.9.2/lib/coderay/style.rb b/vendor/gems/coderay-0.9.7/lib/coderay/style.rb
similarity index 100%
rename from vendor/plugins/coderay-0.9.2/lib/coderay/style.rb
rename to vendor/gems/coderay-0.9.7/lib/coderay/style.rb
diff --git a/vendor/plugins/coderay-0.9.2/lib/coderay/styles/_map.rb b/vendor/gems/coderay-0.9.7/lib/coderay/styles/_map.rb
similarity index 100%
rename from vendor/plugins/coderay-0.9.2/lib/coderay/styles/_map.rb
rename to vendor/gems/coderay-0.9.7/lib/coderay/styles/_map.rb
diff --git a/vendor/plugins/coderay-0.9.2/lib/coderay/styles/cycnus.rb b/vendor/gems/coderay-0.9.7/lib/coderay/styles/cycnus.rb
similarity index 98%
rename from vendor/plugins/coderay-0.9.2/lib/coderay/styles/cycnus.rb
rename to vendor/gems/coderay-0.9.7/lib/coderay/styles/cycnus.rb
index d2a43530..da4f6269 100644
--- a/vendor/plugins/coderay-0.9.2/lib/coderay/styles/cycnus.rb
+++ b/vendor/gems/coderay-0.9.7/lib/coderay/styles/cycnus.rb
@@ -33,6 +33,7 @@ table.CodeRay td { padding: 2px 4px; vertical-align: top }
}
.CodeRay .line_numbers tt { font-weight: bold }
.CodeRay .line_numbers .highlighted { color: red }
+.CodeRay .line { display: block; float: left; width: 100%; }
.CodeRay .no { padding: 0px 4px }
.CodeRay .code { width: 100% }
diff --git a/vendor/plugins/coderay-0.9.2/lib/coderay/styles/murphy.rb b/vendor/gems/coderay-0.9.7/lib/coderay/styles/murphy.rb
similarity index 96%
rename from vendor/plugins/coderay-0.9.2/lib/coderay/styles/murphy.rb
rename to vendor/gems/coderay-0.9.7/lib/coderay/styles/murphy.rb
index 211ab6b0..8345942f 100644
--- a/vendor/plugins/coderay-0.9.2/lib/coderay/styles/murphy.rb
+++ b/vendor/gems/coderay-0.9.7/lib/coderay/styles/murphy.rb
@@ -32,6 +32,8 @@ table.CodeRay td { padding: 2px 4px; vertical-align: top; }
text-align: right;
}
.CodeRay .line_numbers tt { font-weight: bold; }
+.CodeRay .line_numbers .highlighted { color: red }
+.CodeRay .line { display: block; float: left; width: 100%; }
.CodeRay .no { padding: 0px 4px; }
.CodeRay .code { width: 100%; }
diff --git a/vendor/plugins/coderay-0.9.2/lib/coderay/token_classes.rb b/vendor/gems/coderay-0.9.7/lib/coderay/token_classes.rb
similarity index 100%
rename from vendor/plugins/coderay-0.9.2/lib/coderay/token_classes.rb
rename to vendor/gems/coderay-0.9.7/lib/coderay/token_classes.rb
diff --git a/vendor/plugins/coderay-0.9.2/lib/coderay/tokens.rb b/vendor/gems/coderay-0.9.7/lib/coderay/tokens.rb
similarity index 92%
rename from vendor/plugins/coderay-0.9.2/lib/coderay/tokens.rb
rename to vendor/gems/coderay-0.9.7/lib/coderay/tokens.rb
index b01a4ddb..6ac5f440 100644
--- a/vendor/plugins/coderay-0.9.2/lib/coderay/tokens.rb
+++ b/vendor/gems/coderay-0.9.7/lib/coderay/tokens.rb
@@ -7,29 +7,30 @@ module CodeRay
#
# A token is not a special object, just a two-element Array
# consisting of
+ # * the _token_ _text_ (the original source of the token in a String) or
+ # a _token_ _action_ (:open, :close, :begin_line, :end_line)
# * the _token_ _kind_ (a Symbol representing the type of the token)
- # * the _token_ _text_ (the original source of the token in a String)
#
# A token looks like this:
#
- # [:comment, '# It looks like this']
- # [:float, '3.1415926']
- # [:error, '$^']
+ # ['# It looks like this', :comment]
+ # ['3.1415926', :float]
+ # ['$^', :error]
#
- # Some scanners also yield some kind of sub-tokens, represented by special
- # token texts, namely :open and :close .
+ # Some scanners also yield sub-tokens, represented by special
+ # token actions, namely :open and :close.
#
# The Ruby scanner, for example, splits "a string" into:
#
# [
# [:open, :string],
- # [:delimiter, '"'],
- # [:content, 'a string'],
- # [:delimiter, '"'],
+ # ['"', :delimiter],
+ # ['a string', :content],
+ # ['"', :delimiter],
# [:close, :string]
# ]
#
- # Tokens is also the interface between Scanners and Encoders:
+ # Tokens is the interface between Scanners and Encoders:
# The input is split and saved into a Tokens object. The Encoder
# then builds the output from this object.
#
@@ -43,6 +44,9 @@ module CodeRay
# Tokens gives you the power to handle pre-scanned code very easily:
# You can convert it to a webpage, a YAML file, or dump it into a gzip'ed string
# that you put in your DB.
+ #
+ # It also allows you to generate tokens directly (without using a scanner),
+ # to load them from a file, and still use any Encoder that CodeRay provides.
#
# Tokens' subclass TokenStream allows streaming to save memory.
class Tokens < Array
@@ -239,9 +243,7 @@ module CodeRay
size
end
- # The total size of the tokens.
- # Should be equal to the input size before
- # scanning.
+ # Return all text tokens joined into a single string.
def text
map { |t, k| t if t.is_a? ::String }.join
end
@@ -301,11 +303,11 @@ module CodeRay
#
# require 'coderay'
#
- # token_stream = CodeRay::TokenStream.new do |kind, text|
+ # token_stream = CodeRay::TokenStream.new do |text, kind|
# puts 'kind: %s, text size: %d.' % [kind, text.size]
# end
#
- # token_stream << [:regexp, '/\d+/']
+ # token_stream << ['/\d+/', :regexp]
# #-> kind: rexpexp, text size: 5.
#
def initialize &block
diff --git a/vendor/gems/coderay-0.9.7/test/functional/basic.rb b/vendor/gems/coderay-0.9.7/test/functional/basic.rb
new file mode 100644
index 00000000..8ecd3d35
--- /dev/null
+++ b/vendor/gems/coderay-0.9.7/test/functional/basic.rb
@@ -0,0 +1,122 @@
+require 'test/unit'
+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
+
+ RUBY_TEST_CODE = 'puts "Hello, World!"'
+
+ RUBY_TEST_TOKENS = [
+ ['puts', :ident],
+ [' ', :space],
+ [:open, :string],
+ ['"', :delimiter],
+ ['Hello, World!', :content],
+ ['"', :delimiter],
+ [:close, :string]
+ ]
+ def test_simple_scan
+ assert_nothing_raised do
+ assert_equal RUBY_TEST_TOKENS, CodeRay.scan(RUBY_TEST_CODE, :ruby).to_ary
+ 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_duo
+ assert_equal(RUBY_TEST_CODE,
+ CodeRay::Duo[:plain, :plain].highlight(RUBY_TEST_CODE))
+ assert_equal(RUBY_TEST_CODE,
+ CodeRay::Duo[:plain => :plain].highlight(RUBY_TEST_CODE))
+ end
+
+ def test_duo_stream
+ assert_equal(RUBY_TEST_CODE,
+ CodeRay::Duo[:plain, :plain].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] %> + +
+ <%= yield %>
+
+
+
+
+ RHTML
+ assert_equal 0, CodeRay.scan(rHTML, :html).lines_of_code
+ assert_equal 0, CodeRay.scan(rHTML, :php).lines_of_code
+ assert_equal 0, CodeRay.scan(rHTML, :yaml).lines_of_code
+ assert_equal 4, CodeRay.scan(rHTML, :rhtml).lines_of_code
+ end
+
+ def test_rubygems_not_loaded
+ assert_equal nil, defined? Gem
+ end if ENV['check_rubygems'] && RUBY_VERSION < '1.9'
+
+ def test_list_of_encoders
+ assert_kind_of(Array, CodeRay::Encoders.list)
+ assert CodeRay::Encoders.list.include?('count')
+ end
+
+ def test_list_of_scanners
+ assert_kind_of(Array, CodeRay::Scanners.list)
+ assert CodeRay::Scanners.list.include?('plaintext')
+ end
+
+ def test_scan_a_frozen_string
+ CodeRay.scan RUBY_VERSION, :ruby
+ end
+
+end
diff --git a/vendor/gems/coderay-0.9.7/test/functional/basic.rbc b/vendor/gems/coderay-0.9.7/test/functional/basic.rbc
new file mode 100644
index 00000000..1e114cf7
--- /dev/null
+++ b/vendor/gems/coderay-0.9.7/test/functional/basic.rbc
@@ -0,0 +1,2022 @@
+!RBIX
+0
+x
+M
+1
+n
+n
+x
+10
+__script__
+i
+53
+5
+7
+0
+64
+47
+49
+1
+1
+15
+5
+7
+2
+64
+47
+49
+1
+1
+15
+99
+7
+3
+45
+4
+5
+43
+6
+43
+7
+65
+49
+8
+3
+13
+99
+12
+7
+9
+12
+7
+10
+12
+65
+12
+49
+11
+4
+15
+49
+9
+0
+15
+2
+11
+I
+6
+I
+0
+I
+0
+I
+0
+n
+p
+12
+s
+9
+test/unit
+x
+7
+require
+s
+7
+coderay
+x
+9
+BasicTest
+x
+4
+Test
+n
+x
+4
+Unit
+x
+8
+TestCase
+x
+10
+open_class
+x
+14
+__class_init__
+M
+1
+n
+n
+x
+9
+BasicTest
+i
+263
+5
+66
+99
+7
+0
+7
+1
+65
+67
+49
+2
+0
+49
+3
+4
+15
+65
+7
+4
+7
+5
+64
+49
+6
+2
+15
+65
+7
+7
+7
+8
+64
+7
+9
+35
+2
+7
+10
+64
+7
+11
+35
+2
+7
+12
+7
+13
+35
+2
+7
+14
+64
+7
+15
+35
+2
+7
+16
+64
+7
+17
+35
+2
+7
+14
+64
+7
+15
+35
+2
+7
+18
+7
+13
+35
+2
+35
+7
+49
+6
+2
+15
+99
+7
+19
+7
+20
+65
+67
+49
+2
+0
+49
+3
+4
+15
+65
+7
+21
+7
+22
+64
+7
+23
+64
+81
+24
+49
+6
+2
+15
+99
+7
+25
+7
+26
+65
+67
+49
+2
+0
+49
+3
+4
+15
+99
+7
+27
+7
+28
+65
+67
+49
+2
+0
+49
+3
+4
+15
+99
+7
+29
+7
+30
+65
+67
+49
+2
+0
+49
+3
+4
+15
+99
+7
+31
+7
+32
+65
+67
+49
+2
+0
+49
+3
+4
+15
+99
+7
+33
+7
+34
+65
+67
+49
+2
+0
+49
+3
+4
+15
+45
+35
+36
+7
+37
+64
+49
+38
+1
+13
+9
+202
+15
+45
+39
+40
+7
+41
+64
+84
+42
+9
+219
+99
+7
+43
+7
+44
+65
+67
+49
+2
+0
+49
+3
+4
+8
+220
+1
+15
+99
+7
+45
+7
+46
+65
+67
+49
+2
+0
+49
+3
+4
+15
+99
+7
+47
+7
+48
+65
+67
+49
+2
+0
+49
+3
+4
+15
+99
+7
+49
+7
+50
+65
+67
+49
+2
+0
+49
+3
+4
+11
+I
+a
+I
+0
+I
+0
+I
+0
+n
+p
+51
+x
+12
+test_version
+M
+1
+n
+n
+x
+12
+test_version
+i
+8
+5
+56
+0
+47
+50
+1
+0
+11
+I
+2
+I
+0
+I
+0
+I
+0
+n
+p
+2
+M
+1
+p
+2
+x
+9
+for_block
+t
+n
+x
+12
+test_version
+i
+29
+5
+7
+0
+13
+70
+9
+19
+15
+44
+43
+1
+7
+2
+78
+49
+3
+2
+6
+0
+45
+4
+5
+43
+6
+47
+49
+7
+2
+11
+I
+5
+I
+0
+I
+0
+I
+0
+I
+-2
+p
+8
+n
+x
+6
+Regexp
+s
+14
+\A\d\.\d\.\d\z
+x
+3
+new
+x
+7
+CodeRay
+n
+x
+7
+VERSION
+x
+12
+assert_match
+p
+5
+I
+0
+I
+7
+I
+0
+I
+8
+I
+1d
+x
+55
+/Users/murphy/ruby/coderay-0.9/test/functional/basic.rb
+p
+0
+x
+21
+assert_nothing_raised
+p
+5
+I
+0
+I
+6
+I
+0
+I
+7
+I
+8
+x
+55
+/Users/murphy/ruby/coderay-0.9/test/functional/basic.rb
+p
+0
+x
+17
+method_visibility
+x
+15
+add_defn_method
+x
+14
+RUBY_TEST_CODE
+s
+20
+puts "Hello, World!"
+x
+9
+const_set
+x
+16
+RUBY_TEST_TOKENS
+s
+4
+puts
+x
+5
+ident
+s
+1
+
+x
+5
+space
+x
+4
+open
+x
+6
+string
+s
+1
+"
+x
+9
+delimiter
+s
+13
+Hello, World!
+x
+7
+content
+x
+5
+close
+x
+16
+test_simple_scan
+M
+1
+n
+n
+x
+16
+test_simple_scan
+i
+8
+5
+56
+0
+47
+50
+1
+0
+11
+I
+2
+I
+0
+I
+0
+I
+0
+n
+p
+2
+M
+1
+p
+2
+x
+9
+for_block
+t
+n
+x
+16
+test_simple_scan
+i
+23
+5
+45
+0
+1
+45
+2
+3
+45
+4
+5
+7
+6
+49
+7
+2
+49
+8
+0
+47
+49
+9
+2
+11
+I
+6
+I
+0
+I
+0
+I
+0
+I
+-2
+p
+10
+x
+16
+RUBY_TEST_TOKENS
+n
+x
+7
+CodeRay
+n
+x
+14
+RUBY_TEST_CODE
+n
+x
+4
+ruby
+x
+4
+scan
+x
+6
+to_ary
+x
+12
+assert_equal
+p
+5
+I
+0
+I
+18
+I
+0
+I
+19
+I
+17
+x
+55
+/Users/murphy/ruby/coderay-0.9/test/functional/basic.rb
+p
+0
+x
+21
+assert_nothing_raised
+p
+5
+I
+0
+I
+17
+I
+0
+I
+18
+I
+8
+x
+55
+/Users/murphy/ruby/coderay-0.9/test/functional/basic.rb
+p
+0
+x
+14
+RUBY_TEST_HTML
+s
+51
+puts "
+s
+73
+Hello, World!"
+x
+1
++
+x
+21
+test_simple_highlight
+M
+1
+n
+n
+x
+21
+test_simple_highlight
+i
+8
+5
+56
+0
+47
+50
+1
+0
+11
+I
+2
+I
+0
+I
+0
+I
+0
+n
+p
+2
+M
+1
+p
+2
+x
+9
+for_block
+t
+n
+x
+21
+test_simple_highlight
+i
+23
+5
+45
+0
+1
+45
+2
+3
+45
+4
+5
+7
+6
+49
+7
+2
+49
+8
+0
+47
+49
+9
+2
+11
+I
+6
+I
+0
+I
+0
+I
+0
+I
+-2
+p
+10
+x
+14
+RUBY_TEST_HTML
+n
+x
+7
+CodeRay
+n
+x
+14
+RUBY_TEST_CODE
+n
+x
+4
+ruby
+x
+4
+scan
+x
+4
+html
+x
+12
+assert_equal
+p
+5
+I
+0
+I
+20
+I
+0
+I
+21
+I
+17
+x
+55
+/Users/murphy/ruby/coderay-0.9/test/functional/basic.rb
+p
+0
+x
+21
+assert_nothing_raised
+p
+5
+I
+0
+I
+1f
+I
+0
+I
+20
+I
+8
+x
+55
+/Users/murphy/ruby/coderay-0.9/test/functional/basic.rb
+p
+0
+x
+8
+test_duo
+M
+1
+n
+n
+x
+8
+test_duo
+i
+66
+5
+45
+0
+1
+45
+2
+3
+43
+4
+7
+5
+7
+5
+49
+6
+2
+45
+0
+7
+49
+8
+1
+47
+49
+9
+2
+15
+5
+45
+0
+10
+45
+2
+11
+43
+4
+44
+43
+12
+79
+49
+13
+1
+13
+7
+5
+7
+5
+49
+14
+2
+15
+49
+6
+1
+45
+0
+15
+49
+8
+1
+47
+49
+9
+2
+11
+I
+7
+I
+0
+I
+0
+I
+0
+n
+p
+16
+x
+14
+RUBY_TEST_CODE
+n
+x
+7
+CodeRay
+n
+x
+3
+Duo
+x
+5
+plain
+x
+2
+[]
+n
+x
+9
+highlight
+x
+12
+assert_equal
+n
+n
+x
+4
+Hash
+x
+16
+new_from_literal
+x
+3
+[]=
+n
+p
+15
+I
+0
+I
+25
+I
+0
+I
+26
+I
+4
+I
+27
+I
+16
+I
+26
+I
+1b
+I
+28
+I
+1f
+I
+29
+I
+3d
+I
+28
+I
+42
+x
+55
+/Users/murphy/ruby/coderay-0.9/test/functional/basic.rb
+p
+0
+x
+15
+test_duo_stream
+M
+1
+n
+n
+x
+15
+test_duo_stream
+i
+42
+5
+45
+0
+1
+45
+2
+3
+43
+4
+7
+5
+7
+5
+49
+6
+2
+45
+0
+7
+44
+43
+8
+79
+49
+9
+1
+13
+7
+10
+2
+49
+11
+2
+15
+49
+12
+2
+47
+49
+13
+2
+11
+I
+8
+I
+0
+I
+0
+I
+0
+n
+p
+14
+x
+14
+RUBY_TEST_CODE
+n
+x
+7
+CodeRay
+n
+x
+3
+Duo
+x
+5
+plain
+x
+2
+[]
+n
+x
+4
+Hash
+x
+16
+new_from_literal
+x
+6
+stream
+x
+3
+[]=
+x
+9
+highlight
+x
+12
+assert_equal
+p
+9
+I
+0
+I
+2c
+I
+0
+I
+2d
+I
+4
+I
+2e
+I
+25
+I
+2d
+I
+2a
+x
+55
+/Users/murphy/ruby/coderay-0.9/test/functional/basic.rb
+p
+0
+x
+19
+test_comment_filter
+M
+1
+n
+n
+x
+19
+test_comment_filter
+i
+26
+5
+7
+0
+64
+45
+1
+2
+7
+3
+64
+7
+4
+49
+5
+2
+49
+6
+0
+49
+7
+0
+47
+49
+8
+2
+11
+I
+5
+I
+0
+I
+0
+I
+0
+n
+p
+9
+s
+39
+#!/usr/bin/env ruby
+
+code
+
+more code
+
+x
+7
+CodeRay
+n
+s
+127
+#!/usr/bin/env ruby
+=begin
+A multi-line comment.
+=end
+code
+# A single-line comment.
+more code # and another comment, in-line.
+
+x
+4
+ruby
+x
+4
+scan
+x
+14
+comment_filter
+x
+4
+text
+x
+12
+assert_equal
+p
+5
+I
+0
+I
+31
+I
+0
+I
+32
+I
+1a
+x
+55
+/Users/murphy/ruby/coderay-0.9/test/functional/basic.rb
+p
+0
+x
+18
+test_lines_of_code
+M
+1
+n
+n
+x
+18
+test_lines_of_code
+i
+108
+5
+80
+45
+0
+1
+7
+2
+64
+7
+3
+49
+4
+2
+49
+5
+0
+47
+49
+6
+2
+15
+7
+7
+64
+19
+0
+15
+5
+78
+45
+0
+8
+20
+0
+7
+9
+49
+4
+2
+49
+5
+0
+47
+49
+6
+2
+15
+5
+78
+45
+0
+10
+20
+0
+7
+11
+49
+4
+2
+49
+5
+0
+47
+49
+6
+2
+15
+5
+78
+45
+0
+12
+20
+0
+7
+13
+49
+4
+2
+49
+5
+0
+47
+49
+6
+2
+15
+5
+4
+4
+45
+0
+14
+20
+0
+7
+15
+49
+4
+2
+49
+5
+0
+47
+49
+6
+2
+11
+I
+6
+I
+1
+I
+0
+I
+0
+n
+p
+16
+x
+7
+CodeRay
+n
+s
+127
+#!/usr/bin/env ruby
+=begin
+A multi-line comment.
+=end
+code
+# A single-line comment.
+more code # and another comment, in-line.
+
+x
+4
+ruby
+x
+4
+scan
+x
+13
+lines_of_code
+x
+12
+assert_equal
+s
+514
+
+
+
+
+
+ <%= flash[:notice] %> + +
+ <%= yield %>
+
+
+
+
+
+n
+x
+4
+html
+n
+x
+3
+php
+n
+x
+4
+yaml
+n
+x
+5
+rhtml
+p
+15
+I
+0
+I
+43
+I
+0
+I
+44
+I
+15
+I
+4d
+I
+1b
+I
+62
+I
+2f
+I
+63
+I
+43
+I
+64
+I
+57
+I
+65
+I
+6c
+x
+55
+/Users/murphy/ruby/coderay-0.9/test/functional/basic.rb
+p
+1
+x
+5
+rHTML
+x
+3
+ENV
+n
+s
+14
+check_rubygems
+x
+2
+[]
+x
+12
+RUBY_VERSION
+n
+s
+3
+1.9
+x
+1
+<
+x
+24
+test_rubygems_not_loaded
+M
+1
+n
+n
+x
+24
+test_rubygems_not_loaded
+i
+34
+5
+1
+26
+93
+0
+15
+29
+17
+0
+7
+0
+98
+1
+1
+30
+8
+23
+25
+92
+0
+27
+8
+28
+15
+7
+2
+8
+29
+1
+47
+49
+3
+2
+11
+I
+4
+I
+0
+I
+0
+I
+0
+n
+p
+4
+x
+3
+Gem
+x
+16
+vm_const_defined
+s
+8
+constant
+x
+12
+assert_equal
+p
+5
+I
+0
+I
+68
+I
+0
+I
+69
+I
+22
+x
+55
+/Users/murphy/ruby/coderay-0.9/test/functional/basic.rb
+p
+0
+x
+21
+test_list_of_encoders
+M
+1
+n
+n
+x
+21
+test_list_of_encoders
+i
+37
+5
+45
+0
+1
+45
+2
+3
+43
+4
+49
+5
+0
+47
+49
+6
+2
+15
+5
+45
+2
+7
+43
+4
+49
+5
+0
+7
+8
+64
+49
+9
+1
+47
+49
+10
+1
+11
+I
+3
+I
+0
+I
+0
+I
+0
+n
+p
+11
+x
+5
+Array
+n
+x
+7
+CodeRay
+n
+x
+8
+Encoders
+x
+4
+list
+x
+14
+assert_kind_of
+n
+s
+5
+count
+x
+8
+include?
+x
+6
+assert
+p
+7
+I
+0
+I
+6c
+I
+0
+I
+6d
+I
+11
+I
+6e
+I
+25
+x
+55
+/Users/murphy/ruby/coderay-0.9/test/functional/basic.rb
+p
+0
+x
+21
+test_list_of_scanners
+M
+1
+n
+n
+x
+21
+test_list_of_scanners
+i
+37
+5
+45
+0
+1
+45
+2
+3
+43
+4
+49
+5
+0
+47
+49
+6
+2
+15
+5
+45
+2
+7
+43
+4
+49
+5
+0
+7
+8
+64
+49
+9
+1
+47
+49
+10
+1
+11
+I
+3
+I
+0
+I
+0
+I
+0
+n
+p
+11
+x
+5
+Array
+n
+x
+7
+CodeRay
+n
+x
+8
+Scanners
+x
+4
+list
+x
+14
+assert_kind_of
+n
+s
+9
+plaintext
+x
+8
+include?
+x
+6
+assert
+p
+7
+I
+0
+I
+71
+I
+0
+I
+72
+I
+11
+I
+73
+I
+25
+x
+55
+/Users/murphy/ruby/coderay-0.9/test/functional/basic.rb
+p
+0
+x
+25
+test_scan_a_frozen_string
+M
+1
+n
+n
+x
+25
+test_scan_a_frozen_string
+i
+12
+45
+0
+1
+45
+2
+3
+7
+4
+49
+5
+2
+11
+I
+3
+I
+0
+I
+0
+I
+0
+n
+p
+6
+x
+7
+CodeRay
+n
+x
+12
+RUBY_VERSION
+n
+x
+4
+ruby
+x
+4
+scan
+p
+5
+I
+0
+I
+76
+I
+0
+I
+77
+I
+c
+x
+55
+/Users/murphy/ruby/coderay-0.9/test/functional/basic.rb
+p
+0
+p
+51
+I
+2
+I
+6
+I
+10
+I
+c
+I
+1a
+I
+e
+I
+1d
+I
+f
+I
+24
+I
+10
+I
+2b
+I
+11
+I
+31
+I
+12
+I
+38
+I
+13
+I
+3f
+I
+14
+I
+46
+I
+15
+I
+52
+I
+17
+I
+60
+I
+1d
+I
+63
+I
+1d
+I
+66
+I
+1e
+I
+6f
+I
+1f
+I
+7d
+I
+25
+I
+8b
+I
+2c
+I
+99
+I
+31
+I
+a7
+I
+43
+I
+b5
+I
+6a
+I
+cc
+I
+68
+I
+db
+I
+6a
+I
+dd
+I
+6c
+I
+eb
+I
+71
+I
+f9
+I
+76
+I
+107
+x
+55
+/Users/murphy/ruby/coderay-0.9/test/functional/basic.rb
+p
+0
+x
+13
+attach_method
+p
+7
+I
+0
+I
+1
+I
+9
+I
+2
+I
+12
+I
+4
+I
+35
+x
+55
+/Users/murphy/ruby/coderay-0.9/test/functional/basic.rb
+p
+0
diff --git a/vendor/gems/coderay-0.9.7/test/functional/for_redcloth.rb b/vendor/gems/coderay-0.9.7/test/functional/for_redcloth.rb
new file mode 100644
index 00000000..efd05782
--- /dev/null
+++ b/vendor/gems/coderay-0.9.7/test/functional/for_redcloth.rb
@@ -0,0 +1,77 @@
+require 'test/unit'
+$:.unshift 'lib'
+require 'coderay'
+
+begin
+ require 'rubygems' unless defined? Gem
+ gem 'RedCloth', '>= 4.0.3' rescue nil
+ require 'redcloth'
+rescue LoadError
+ warn 'RedCloth not found - skipping for_redcloth tests.'
+end
+
+class BasicTest < Test::Unit::TestCase
+
+ def test_for_redcloth
+ require 'coderay/for_redcloth'
+ assert_equal "puts "Hello, World!" ", + RedCloth.new('@[ruby]puts "Hello, World!"@').to_html + assert_equal <<-BLOCKCODE.chomp, +
+
+ BLOCKCODE
+ RedCloth.new('bc[ruby]. puts "Hello, World!"').to_html
+ end
+
+ def test_for_redcloth_no_lang
+ require 'coderay/for_redcloth'
+ assert_equal "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,
+
+ 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, +
+
+ BLOCKCODE
+ RedCloth.new('bc[ruby]. &').to_html
+ end
+
+ def test_for_redcloth_escapes2
+ require 'coderay/for_redcloth'
+ assert_equal "& #include <test.h> ", + RedCloth.new('@[c]#include
_dff.skjd ", + RedCloth.new('@[ruby]_dff.skjd@').to_html + assert_equal <<-BLOCKCODE.chomp, +
+ BLOCKCODE
+ RedCloth.new('bc. [project]_dff.skjd').to_html
+ end
+
+end if defined? RedCloth
\ No newline at end of file
diff --git a/vendor/gems/coderay-0.9.7/test/functional/for_redcloth.rbc b/vendor/gems/coderay-0.9.7/test/functional/for_redcloth.rbc
new file mode 100644
index 00000000..09a7fc84
--- /dev/null
+++ b/vendor/gems/coderay-0.9.7/test/functional/for_redcloth.rbc
@@ -0,0 +1,1708 @@
+!RBIX
+0
+x
+M
+1
+n
+n
+x
+10
+__script__
+i
+249
+5
+7
+0
+64
+47
+49
+1
+1
+15
+99
+43
+2
+7
+3
+49
+4
+1
+7
+5
+64
+49
+6
+1
+15
+5
+7
+7
+64
+47
+49
+1
+1
+15
+26
+93
+0
+15
+29
+144
+0
+26
+93
+1
+15
+29
+55
+0
+7
+8
+98
+9
+1
+30
+8
+61
+25
+92
+1
+27
+8
+66
+15
+7
+10
+8
+67
+1
+9
+72
+1
+8
+80
+5
+7
+11
+64
+47
+49
+1
+1
+15
+26
+93
+2
+15
+29
+102
+0
+5
+7
+12
+64
+7
+13
+64
+47
+49
+14
+2
+30
+8
+129
+26
+93
+3
+15
+24
+13
+45
+15
+16
+12
+49
+17
+1
+10
+119
+8
+124
+15
+1
+25
+8
+129
+15
+92
+3
+27
+34
+92
+2
+27
+15
+5
+7
+18
+64
+47
+49
+1
+1
+30
+8
+178
+26
+93
+4
+15
+24
+13
+45
+19
+20
+12
+49
+17
+1
+10
+161
+8
+173
+15
+5
+7
+21
+64
+47
+49
+22
+1
+25
+8
+178
+15
+92
+4
+27
+34
+92
+0
+27
+15
+26
+93
+5
+15
+29
+197
+0
+7
+23
+98
+9
+1
+30
+8
+203
+25
+92
+5
+27
+8
+208
+15
+7
+10
+8
+209
+1
+9
+245
+99
+7
+24
+45
+25
+26
+43
+27
+43
+28
+65
+49
+29
+3
+13
+99
+12
+7
+30
+12
+7
+31
+12
+65
+12
+49
+32
+4
+15
+49
+30
+0
+8
+246
+1
+15
+2
+11
+I
+c
+I
+0
+I
+0
+I
+0
+n
+p
+33
+s
+9
+test/unit
+x
+7
+require
+x
+7
+Globals
+x
+2
+$:
+x
+2
+[]
+s
+3
+lib
+x
+2
+<<
+s
+7
+coderay
+x
+3
+Gem
+x
+16
+vm_const_defined
+s
+8
+constant
+s
+8
+rubygems
+s
+8
+RedCloth
+s
+8
+>= 4.0.3
+x
+3
+gem
+x
+13
+StandardError
+n
+x
+3
+===
+s
+8
+redcloth
+x
+9
+LoadError
+n
+s
+49
+RedCloth not found - skipping for_redcloth tests.
+x
+4
+warn
+x
+8
+RedCloth
+x
+9
+BasicTest
+x
+4
+Test
+n
+x
+4
+Unit
+x
+8
+TestCase
+x
+10
+open_class
+x
+14
+__class_init__
+M
+1
+n
+n
+x
+9
+BasicTest
+i
+86
+5
+66
+99
+7
+0
+7
+1
+65
+67
+49
+2
+0
+49
+3
+4
+15
+99
+7
+4
+7
+5
+65
+67
+49
+2
+0
+49
+3
+4
+15
+99
+7
+6
+7
+7
+65
+67
+49
+2
+0
+49
+3
+4
+15
+99
+7
+8
+7
+9
+65
+67
+49
+2
+0
+49
+3
+4
+15
+99
+7
+10
+7
+11
+65
+67
+49
+2
+0
+49
+3
+4
+15
+99
+7
+12
+7
+13
+65
+67
+49
+2
+0
+49
+3
+4
+11
+I
+5
+I
+0
+I
+0
+I
+0
+n
+p
+14
+x
+17
+test_for_redcloth
+M
+1
+n
+n
+x
+17
+test_for_redcloth
+i
+96
+5
+7
+0
+64
+47
+49
+1
+1
+15
+5
+7
+2
+64
+45
+3
+4
+13
+71
+5
+47
+9
+37
+47
+49
+6
+0
+13
+7
+7
+64
+47
+49
+8
+1
+15
+8
+43
+7
+7
+64
+49
+5
+1
+49
+9
+0
+47
+49
+10
+2
+15
+5
+7
+11
+64
+49
+12
+0
+45
+3
+13
+13
+71
+5
+47
+9
+82
+47
+49
+6
+0
+13
+7
+14
+64
+47
+49
+8
+1
+15
+8
+88
+7
+14
+64
+49
+5
+1
+49
+9
+0
+47
+49
+10
+2
+11
+I
+5
+I
+0
+I
+0
+I
+0
+n
+p
+15
+s
+20
+coderay/for_redcloth
+x
+7
+require
+s
+221
+puts "Hello, World!" +x +8 +RedCloth +n +x +3 +new +x +8 +allocate +s +28 +@[ruby]puts "Hello, World!"@ +x +10 +initialize +x +7 +to_html +x +12 +assert_equal +s +252 +
+
+
+x
+5
+chomp
+n
+s
+30
+bc[ruby]. puts "Hello, World!"
+p
+17
+I
+0
+I
+f
+I
+0
+I
+10
+I
+9
+I
+11
+I
+d
+I
+12
+I
+2e
+I
+11
+I
+33
+I
+13
+I
+3a
+I
+18
+I
+5b
+I
+13
+I
+60
+x
+62
+/Users/murphy/ruby/coderay-0.9/test/functional/for_redcloth.rb
+p
+0
+x
+17
+method_visibility
+x
+15
+add_defn_method
+x
+25
+test_for_redcloth_no_lang
+M
+1
+n
+n
+x
+25
+test_for_redcloth_no_lang
+i
+96
+5
+7
+0
+64
+47
+49
+1
+1
+15
+5
+7
+2
+64
+45
+3
+4
+13
+71
+5
+47
+9
+37
+47
+49
+6
+0
+13
+7
+7
+64
+47
+49
+8
+1
+15
+8
+43
+7
+7
+64
+49
+5
+1
+49
+9
+0
+47
+49
+10
+2
+15
+5
+7
+11
+64
+49
+12
+0
+45
+3
+13
+13
+71
+5
+47
+9
+82
+47
+49
+6
+0
+13
+7
+14
+64
+47
+49
+8
+1
+15
+8
+88
+7
+14
+64
+49
+5
+1
+49
+9
+0
+47
+49
+10
+2
+11
+I
+5
+I
+0
+I
+0
+I
+0
+n
+p
+15
+s
+20
+coderay/for_redcloth
+x
+7
+require
+s
+40
+puts "Hello, World!"
+
+x
+5
+chomp
+n
+s
+24
+bc. puts "Hello, World!"
+p
+17
+I
+0
+I
+1b
+I
+0
+I
+1c
+I
+9
+I
+1d
+I
+d
+I
+1e
+I
+2e
+I
+1d
+I
+33
+I
+1f
+I
+3a
+I
+22
+I
+5b
+I
+1f
+I
+60
+x
+62
+/Users/murphy/ruby/coderay-0.9/test/functional/for_redcloth.rb
+p
+0
+x
+23
+test_for_redcloth_style
+M
+1
+n
+n
+x
+23
+test_for_redcloth_style
+i
+54
+5
+7
+0
+64
+47
+49
+1
+1
+15
+5
+7
+2
+64
+49
+3
+0
+45
+4
+5
+13
+71
+6
+47
+9
+40
+47
+49
+7
+0
+13
+7
+8
+64
+47
+49
+9
+1
+15
+8
+46
+7
+8
+64
+49
+6
+1
+49
+10
+0
+47
+49
+11
+2
+11
+I
+5
+I
+0
+I
+0
+I
+0
+n
+p
+12
+s
+20
+coderay/for_redcloth
+x
+7
+require
+s
+85
+
+
+x
+5
+chomp
+x
+8
+RedCloth
+n
+x
+3
+new
+x
+8
+allocate
+s
+36
+bc{color: red}. puts "Hello, World!"
+x
+10
+initialize
+x
+7
+to_html
+x
+12
+assert_equal
+p
+11
+I
+0
+I
+25
+I
+0
+I
+26
+I
+9
+I
+27
+I
+10
+I
+2a
+I
+31
+I
+27
+I
+36
+x
+62
+/Users/murphy/ruby/coderay-0.9/test/functional/for_redcloth.rb
+p
+0
+x
+25
+test_for_redcloth_escapes
+M
+1
+n
+n
+x
+25
+test_for_redcloth_escapes
+i
+96
+5
+7
+0
+64
+47
+49
+1
+1
+15
+5
+7
+2
+64
+45
+3
+4
+13
+71
+5
+47
+9
+37
+47
+49
+6
+0
+13
+7
+7
+64
+47
+49
+8
+1
+15
+8
+43
+7
+7
+64
+49
+5
+1
+49
+9
+0
+47
+49
+10
+2
+15
+5
+7
+11
+64
+49
+12
+0
+45
+3
+13
+13
+71
+5
+47
+9
+82
+47
+49
+6
+0
+13
+7
+14
+64
+47
+49
+8
+1
+15
+8
+88
+7
+14
+64
+49
+5
+1
+49
+9
+0
+47
+49
+10
+2
+11
+I
+5
+I
+0
+I
+0
+I
+0
+n
+p
+15
+s
+20
+coderay/for_redcloth
+x
+7
+require
+s
+52
+> +x +8 +RedCloth +n +x +3 +new +x +8 +allocate +s +9 +@[ruby]>@ +x +10 +initialize +x +7 +to_html +x +12 +assert_equal +s +84 +
+
+
+x
+5
+chomp
+n
+s
+11
+bc[ruby]. &
+p
+17
+I
+0
+I
+2d
+I
+0
+I
+2e
+I
+9
+I
+2f
+I
+d
+I
+30
+I
+2e
+I
+2f
+I
+33
+I
+31
+I
+3a
+I
+36
+I
+5b
+I
+31
+I
+60
+x
+62
+/Users/murphy/ruby/coderay-0.9/test/functional/for_redcloth.rb
+p
+0
+x
+26
+test_for_redcloth_escapes2
+M
+1
+n
+n
+x
+26
+test_for_redcloth_escapes2
+i
+51
+5
+7
+0
+64
+47
+49
+1
+1
+15
+5
+7
+2
+64
+45
+3
+4
+13
+71
+5
+47
+9
+37
+47
+49
+6
+0
+13
+7
+7
+64
+47
+49
+8
+1
+15
+8
+43
+7
+7
+64
+49
+5
+1
+49
+9
+0
+47
+49
+10
+2
+11
+I
+5
+I
+0
+I
+0
+I
+0
+n
+p
+11
+s
+20
+coderay/for_redcloth
+x
+7
+require
+s
+149
+& #include <test.h> +x +8 +RedCloth +n +x +3 +new +x +8 +allocate +s +22 +@[c]#include
_dff.skjd +n +s +17 +@[ruby]_dff.skjd@ +s +43 +
+
+x
+5
+chomp
+n
+s
+22
+bc. [project]_dff.skjd
+p
+23
+I
+0
+I
+40
+I
+0
+I
+41
+I
+9
+I
+42
+I
+d
+I
+43
+I
+2e
+I
+42
+I
+33
+I
+45
+I
+37
+I
+46
+I
+58
+I
+45
+I
+5d
+I
+47
+I
+64
+I
+4a
+I
+85
+I
+47
+I
+8a
+x
+62
+/Users/murphy/ruby/coderay-0.9/test/functional/for_redcloth.rb
+p
+0
+p
+13
+I
+2
+I
+f
+I
+10
+I
+1b
+I
+1e
+I
+25
+I
+2c
+I
+2d
+I
+3a
+I
+39
+I
+48
+I
+40
+I
+56
+x
+62
+/Users/murphy/ruby/coderay-0.9/test/functional/for_redcloth.rb
+p
+0
+x
+13
+attach_method
+p
+23
+I
+0
+I
+1
+I
+9
+I
+2
+I
+18
+I
+3
+I
+21
+I
+6
+I
+51
+I
+7
+I
+85
+I
+8
+I
+95
+I
+9
+I
+a2
+I
+a
+I
+b6
+I
+4d
+I
+d3
+I
+d
+I
+f5
+I
+4d
+I
+f9
+x
+62
+/Users/murphy/ruby/coderay-0.9/test/functional/for_redcloth.rb
+p
+0
diff --git a/vendor/gems/coderay-0.9.7/test/functional/load_plugin_scanner.rb b/vendor/gems/coderay-0.9.7/test/functional/load_plugin_scanner.rb
new file mode 100644
index 00000000..25bbc93a
--- /dev/null
+++ b/vendor/gems/coderay-0.9.7/test/functional/load_plugin_scanner.rb
@@ -0,0 +1,11 @@
+require 'test/unit'
+require 'coderay'
+
+class PluginScannerTest < Test::Unit::TestCase
+
+ def test_load
+ require File.join(File.dirname(__FILE__), 'vhdl')
+ assert_equal 'VHDL', CodeRay.scanner(:vhdl).class.name
+ end
+
+end
diff --git a/vendor/gems/coderay-0.9.7/test/functional/load_plugin_scanner.rbc b/vendor/gems/coderay-0.9.7/test/functional/load_plugin_scanner.rbc
new file mode 100644
index 00000000..ef61d340
--- /dev/null
+++ b/vendor/gems/coderay-0.9.7/test/functional/load_plugin_scanner.rbc
@@ -0,0 +1,317 @@
+!RBIX
+0
+x
+M
+1
+n
+n
+x
+10
+__script__
+i
+53
+5
+7
+0
+64
+47
+49
+1
+1
+15
+5
+7
+2
+64
+47
+49
+1
+1
+15
+99
+7
+3
+45
+4
+5
+43
+6
+43
+7
+65
+49
+8
+3
+13
+99
+12
+7
+9
+12
+7
+10
+12
+65
+12
+49
+11
+4
+15
+49
+9
+0
+15
+2
+11
+I
+6
+I
+0
+I
+0
+I
+0
+n
+p
+12
+s
+9
+test/unit
+x
+7
+require
+s
+7
+coderay
+x
+17
+PluginScannerTest
+x
+4
+Test
+n
+x
+4
+Unit
+x
+8
+TestCase
+x
+10
+open_class
+x
+14
+__class_init__
+M
+1
+n
+n
+x
+17
+PluginScannerTest
+i
+16
+5
+66
+99
+7
+0
+7
+1
+65
+67
+49
+2
+0
+49
+3
+4
+11
+I
+5
+I
+0
+I
+0
+I
+0
+n
+p
+4
+x
+9
+test_load
+M
+1
+n
+n
+x
+9
+test_load
+i
+48
+5
+45
+0
+1
+45
+0
+2
+65
+49
+3
+0
+49
+4
+1
+7
+5
+64
+49
+6
+2
+47
+49
+7
+1
+15
+5
+7
+8
+64
+45
+9
+10
+7
+11
+49
+12
+1
+49
+13
+0
+49
+14
+0
+47
+49
+15
+2
+11
+I
+4
+I
+0
+I
+0
+I
+0
+n
+p
+16
+x
+4
+File
+n
+n
+x
+11
+active_path
+x
+7
+dirname
+s
+4
+vhdl
+x
+4
+join
+x
+7
+require
+s
+4
+VHDL
+x
+7
+CodeRay
+n
+x
+4
+vhdl
+x
+7
+scanner
+x
+5
+class
+x
+4
+name
+x
+12
+assert_equal
+p
+7
+I
+0
+I
+6
+I
+0
+I
+7
+I
+19
+I
+8
+I
+30
+x
+69
+/Users/murphy/ruby/coderay-0.9/test/functional/load_plugin_scanner.rb
+p
+0
+x
+17
+method_visibility
+x
+15
+add_defn_method
+p
+3
+I
+2
+I
+6
+I
+10
+x
+69
+/Users/murphy/ruby/coderay-0.9/test/functional/load_plugin_scanner.rb
+p
+0
+x
+13
+attach_method
+p
+7
+I
+0
+I
+1
+I
+9
+I
+2
+I
+12
+I
+4
+I
+35
+x
+69
+/Users/murphy/ruby/coderay-0.9/test/functional/load_plugin_scanner.rb
+p
+0
diff --git a/vendor/gems/coderay-0.9.7/test/functional/suite.rb b/vendor/gems/coderay-0.9.7/test/functional/suite.rb
new file mode 100644
index 00000000..97dd330d
--- /dev/null
+++ b/vendor/gems/coderay-0.9.7/test/functional/suite.rb
@@ -0,0 +1,12 @@
+require 'test/unit'
+
+MYDIR = File.dirname(__FILE__)
+
+$:.unshift 'lib'
+require 'coderay'
+puts "Running basic CodeRay #{CodeRay::VERSION} tests..."
+
+suite = %w(basic load_plugin_scanner word_list)
+for test_case in suite
+ load File.join(MYDIR, test_case + '.rb')
+end
diff --git a/vendor/gems/coderay-0.9.7/test/functional/suite.rbc b/vendor/gems/coderay-0.9.7/test/functional/suite.rbc
new file mode 100644
index 00000000..977354ae
--- /dev/null
+++ b/vendor/gems/coderay-0.9.7/test/functional/suite.rbc
@@ -0,0 +1,322 @@
+!RBIX
+0
+x
+M
+1
+n
+n
+x
+10
+__script__
+i
+95
+5
+7
+0
+64
+47
+49
+1
+1
+15
+65
+7
+2
+45
+3
+4
+65
+49
+5
+0
+49
+6
+1
+49
+7
+2
+15
+99
+43
+8
+7
+9
+49
+10
+1
+7
+11
+64
+49
+12
+1
+15
+5
+7
+13
+64
+47
+49
+1
+1
+15
+5
+7
+14
+45
+15
+16
+43
+17
+47
+49
+18
+0
+7
+19
+63
+3
+47
+49
+20
+1
+15
+7
+21
+64
+7
+22
+64
+7
+23
+64
+35
+3
+19
+0
+15
+20
+0
+56
+24
+50
+25
+0
+15
+2
+11
+I
+6
+I
+2
+I
+0
+I
+0
+n
+p
+26
+s
+9
+test/unit
+x
+7
+require
+x
+5
+MYDIR
+x
+4
+File
+n
+x
+11
+active_path
+x
+7
+dirname
+x
+9
+const_set
+x
+7
+Globals
+x
+2
+$:
+x
+2
+[]
+s
+3
+lib
+x
+2
+<<
+s
+7
+coderay
+s
+22
+Running basic CodeRay
+x
+7
+CodeRay
+n
+x
+7
+VERSION
+x
+4
+to_s
+s
+9
+ tests...
+x
+4
+puts
+s
+5
+basic
+s
+19
+load_plugin_scanner
+s
+9
+word_list
+M
+1
+p
+2
+x
+9
+for_block
+t
+n
+x
+9
+__block__
+i
+28
+57
+22
+1
+1
+15
+5
+45
+0
+1
+45
+2
+3
+21
+1
+1
+7
+4
+64
+81
+5
+49
+6
+2
+47
+49
+7
+1
+11
+I
+6
+I
+0
+I
+1
+I
+1
+n
+p
+8
+x
+4
+File
+n
+x
+5
+MYDIR
+n
+s
+3
+.rb
+x
+1
++
+x
+4
+join
+x
+4
+load
+p
+5
+I
+0
+I
+a
+I
+5
+I
+b
+I
+1c
+x
+55
+/Users/murphy/ruby/coderay-0.9/test/functional/suite.rb
+p
+0
+x
+4
+each
+p
+15
+I
+0
+I
+1
+I
+9
+I
+3
+I
+1a
+I
+5
+I
+29
+I
+6
+I
+32
+I
+7
+I
+47
+I
+9
+I
+55
+I
+a
+I
+5f
+x
+55
+/Users/murphy/ruby/coderay-0.9/test/functional/suite.rb
+p
+2
+x
+5
+suite
+x
+9
+test_case
diff --git a/vendor/gems/coderay-0.9.7/test/functional/vhdl.rb b/vendor/gems/coderay-0.9.7/test/functional/vhdl.rb
new file mode 100644
index 00000000..c7e38243
--- /dev/null
+++ b/vendor/gems/coderay-0.9.7/test/functional/vhdl.rb
@@ -0,0 +1,126 @@
+class VHDL < CodeRay::Scanners::Scanner
+
+ register_for :vhdl
+
+ RESERVED_WORDS = [
+ 'access','after','alias','all','assert','architecture','begin',
+ 'block','body','buffer','bus','case','component','configuration','constant',
+ 'disconnect','downto','else','elsif','end','entity','exit','file','for',
+ 'function','generate','generic','group','guarded','if','impure','in',
+ 'inertial','inout','is','label','library','linkage','literal','loop',
+ 'map','new','next','null','of','on','open','others','out','package',
+ 'port','postponed','procedure','process','pure','range','record','register',
+ 'reject','report','return','select','severity','signal','shared','subtype',
+ 'then','to','transport','type','unaffected','units','until','use','variable',
+ 'wait','when','while','with','note','warning','error','failure','and',
+ 'or','xor','not','nor',
+ 'array'
+ ]
+
+ PREDEFINED_TYPES = [
+ 'bit','bit_vector','character','boolean','integer','real','time','string',
+ 'severity_level','positive','natural','signed','unsigned','line','text',
+ 'std_logic','std_logic_vector','std_ulogic','std_ulogic_vector','qsim_state',
+ 'qsim_state_vector','qsim_12state','qsim_12state_vector','qsim_strength',
+ 'mux_bit','mux_vector','reg_bit','reg_vector','wor_bit','wor_vector'
+ ]
+
+ PREDEFINED_CONSTANTS = [
+
+ ]
+
+ IDENT_KIND = CodeRay::CaseIgnoringWordList.new(:ident).
+ add(RESERVED_WORDS, :reserved).
+ add(PREDEFINED_TYPES, :pre_type).
+ add(PREDEFINED_CONSTANTS, :pre_constant)
+
+ ESCAPE = / [rbfntv\n\\'"] | x[a-fA-F0-9]{1,2} | [0-7]{1,3} /x
+ UNICODE_ESCAPE = / u[a-fA-F0-9]{4} | U[a-fA-F0-9]{8} /x
+
+ def scan_tokens tokens, options
+
+ state = :initial
+
+ until eos?
+
+ kind = nil
+ match = nil
+
+ case state
+
+ when :initial
+
+ if scan(/ \s+ | \\\n /x)
+ kind = :space
+
+ elsif scan(/-- .*/x)
+ kind = :comment
+
+ elsif scan(/ [-+*\/=<>?:;,!&^|()\[\]{}~%]+ | \.(?!\d) /x)
+ kind = :operator
+
+ elsif match = scan(/ [A-Za-z_][A-Za-z_0-9]* /x)
+ kind = IDENT_KIND[match.downcase]
+
+ elsif match = scan(/[a-z]?"/i)
+ tokens << [:open, :string]
+ state = :string
+ kind = :delimiter
+
+ elsif scan(/ L?' (?: [^\'\n\\] | \\ #{ESCAPE} )? '? /ox)
+ kind = :char
+
+ elsif scan(/(?:\d+)(?![.eEfF])/)
+ kind = :integer
+
+ elsif scan(/\d[fF]?|\d*\.\d+(?:[eE][+-]?\d+)?[fF]?|\d+[eE][+-]?\d+[fF]?/)
+ kind = :float
+
+ else
+ getch
+ kind = :error
+
+ end
+
+ when :string
+ if scan(/[^\\\n"]+/)
+ kind = :content
+ elsif scan(/"/)
+ tokens << ['"', :delimiter]
+ tokens << [:close, :string]
+ state = :initial
+ next
+ elsif scan(/ \\ (?: #{ESCAPE} | #{UNICODE_ESCAPE} ) /mox)
+ kind = :char
+ elsif scan(/ \\ | $ /x)
+ tokens << [:close, :string]
+ kind = :error
+ state = :initial
+ else
+ raise_inspect "else case \" reached; %p not handled." % peek(1), tokens
+ end
+
+ else
+ raise_inspect 'Unknown state', tokens
+
+ end
+
+ match ||= matched
+ if $DEBUG and not kind
+ raise_inspect 'Error token %p in line %d' %
+ [[match, kind], line], tokens
+ end
+ raise_inspect 'Empty token', tokens unless match
+
+ tokens << [match, kind]
+
+ end
+
+ if state == :string
+ tokens << [:close, :string]
+ end
+
+ tokens
+ end
+
+end
diff --git a/vendor/gems/coderay-0.9.7/test/functional/vhdl.rbc b/vendor/gems/coderay-0.9.7/test/functional/vhdl.rbc
new file mode 100644
index 00000000..80d01bf6
--- /dev/null
+++ b/vendor/gems/coderay-0.9.7/test/functional/vhdl.rbc
@@ -0,0 +1,2334 @@
+!RBIX
+0
+x
+M
+1
+n
+n
+x
+10
+__script__
+i
+35
+99
+7
+0
+45
+1
+2
+43
+3
+43
+4
+65
+49
+5
+3
+13
+99
+12
+7
+6
+12
+7
+7
+12
+65
+12
+49
+8
+4
+15
+49
+6
+0
+15
+2
+11
+I
+6
+I
+0
+I
+0
+I
+0
+n
+p
+9
+x
+4
+VHDL
+x
+7
+CodeRay
+n
+x
+8
+Scanners
+x
+7
+Scanner
+x
+10
+open_class
+x
+14
+__class_init__
+M
+1
+n
+n
+x
+4
+VHDL
+i
+519
+5
+66
+5
+7
+0
+47
+49
+1
+1
+15
+65
+7
+2
+7
+3
+64
+7
+4
+64
+7
+5
+64
+7
+6
+64
+7
+7
+64
+7
+8
+64
+7
+9
+64
+7
+10
+64
+7
+11
+64
+7
+12
+64
+7
+13
+64
+7
+14
+64
+7
+15
+64
+7
+16
+64
+7
+17
+64
+7
+18
+64
+7
+19
+64
+7
+20
+64
+7
+21
+64
+7
+22
+64
+7
+23
+64
+7
+24
+64
+7
+25
+64
+7
+26
+64
+7
+27
+64
+7
+28
+64
+7
+29
+64
+7
+30
+64
+7
+31
+64
+7
+32
+64
+7
+33
+64
+7
+34
+64
+7
+35
+64
+7
+36
+64
+7
+37
+64
+7
+38
+64
+7
+39
+64
+7
+40
+64
+7
+41
+64
+7
+42
+64
+7
+43
+64
+7
+44
+64
+7
+45
+64
+7
+46
+64
+7
+47
+64
+7
+48
+64
+7
+49
+64
+7
+50
+64
+7
+51
+64
+7
+52
+64
+7
+53
+64
+7
+54
+64
+7
+55
+64
+7
+56
+64
+7
+57
+64
+7
+58
+64
+7
+59
+64
+7
+60
+64
+7
+61
+64
+7
+62
+64
+7
+63
+64
+7
+64
+64
+7
+65
+64
+7
+66
+64
+7
+67
+64
+7
+68
+64
+7
+69
+64
+7
+70
+64
+7
+71
+64
+7
+72
+64
+7
+73
+64
+7
+74
+64
+7
+75
+64
+7
+76
+64
+7
+77
+64
+7
+78
+64
+7
+79
+64
+7
+80
+64
+7
+81
+64
+7
+82
+64
+7
+83
+64
+7
+84
+64
+7
+85
+64
+7
+86
+64
+7
+87
+64
+7
+88
+64
+7
+89
+64
+7
+90
+64
+7
+91
+64
+35
+89
+49
+92
+2
+15
+65
+7
+93
+7
+94
+64
+7
+95
+64
+7
+96
+64
+7
+97
+64
+7
+98
+64
+7
+99
+64
+7
+100
+64
+7
+101
+64
+7
+102
+64
+7
+103
+64
+7
+104
+64
+7
+105
+64
+7
+106
+64
+7
+107
+64
+7
+108
+64
+7
+109
+64
+7
+110
+64
+7
+111
+64
+7
+112
+64
+7
+113
+64
+7
+114
+64
+7
+115
+64
+7
+116
+64
+7
+117
+64
+7
+118
+64
+7
+119
+64
+7
+120
+64
+7
+121
+64
+7
+122
+64
+7
+123
+64
+35
+30
+49
+92
+2
+15
+65
+7
+124
+35
+0
+49
+92
+2
+15
+65
+7
+125
+45
+126
+127
+43
+128
+13
+71
+129
+47
+9
+422
+47
+49
+130
+0
+13
+7
+131
+47
+49
+132
+1
+15
+8
+427
+7
+131
+49
+129
+1
+45
+2
+133
+7
+134
+49
+135
+2
+45
+93
+136
+7
+137
+49
+135
+2
+45
+124
+138
+7
+139
+49
+135
+2
+49
+92
+2
+15
+65
+7
+140
+7
+141
+13
+70
+9
+476
+15
+44
+43
+142
+7
+143
+80
+49
+129
+2
+6
+141
+49
+92
+2
+15
+65
+7
+144
+7
+145
+13
+70
+9
+501
+15
+44
+43
+142
+7
+146
+80
+49
+129
+2
+6
+145
+49
+92
+2
+15
+99
+7
+147
+7
+148
+65
+67
+49
+149
+0
+49
+150
+4
+11
+I
+5b
+I
+0
+I
+0
+I
+0
+n
+p
+151
+x
+4
+vhdl
+x
+12
+register_for
+x
+14
+RESERVED_WORDS
+s
+6
+access
+s
+5
+after
+s
+5
+alias
+s
+3
+all
+s
+6
+assert
+s
+12
+architecture
+s
+5
+begin
+s
+5
+block
+s
+4
+body
+s
+6
+buffer
+s
+3
+bus
+s
+4
+case
+s
+9
+component
+s
+13
+configuration
+s
+8
+constant
+s
+10
+disconnect
+s
+6
+downto
+s
+4
+else
+s
+5
+elsif
+s
+3
+end
+s
+6
+entity
+s
+4
+exit
+s
+4
+file
+s
+3
+for
+s
+8
+function
+s
+8
+generate
+s
+7
+generic
+s
+5
+group
+s
+7
+guarded
+s
+2
+if
+s
+6
+impure
+s
+2
+in
+s
+8
+inertial
+s
+5
+inout
+s
+2
+is
+s
+5
+label
+s
+7
+library
+s
+7
+linkage
+s
+7
+literal
+s
+4
+loop
+s
+3
+map
+s
+3
+new
+s
+4
+next
+s
+4
+null
+s
+2
+of
+s
+2
+on
+s
+4
+open
+s
+6
+others
+s
+3
+out
+s
+7
+package
+s
+4
+port
+s
+9
+postponed
+s
+9
+procedure
+s
+7
+process
+s
+4
+pure
+s
+5
+range
+s
+6
+record
+s
+8
+register
+s
+6
+reject
+s
+6
+report
+s
+6
+return
+s
+6
+select
+s
+8
+severity
+s
+6
+signal
+s
+6
+shared
+s
+7
+subtype
+s
+4
+then
+s
+2
+to
+s
+9
+transport
+s
+4
+type
+s
+10
+unaffected
+s
+5
+units
+s
+5
+until
+s
+3
+use
+s
+8
+variable
+s
+4
+wait
+s
+4
+when
+s
+5
+while
+s
+4
+with
+s
+4
+note
+s
+7
+warning
+s
+5
+error
+s
+7
+failure
+s
+3
+and
+s
+2
+or
+s
+3
+xor
+s
+3
+not
+s
+3
+nor
+s
+5
+array
+x
+9
+const_set
+x
+16
+PREDEFINED_TYPES
+s
+3
+bit
+s
+10
+bit_vector
+s
+9
+character
+s
+7
+boolean
+s
+7
+integer
+s
+4
+real
+s
+4
+time
+s
+6
+string
+s
+14
+severity_level
+s
+8
+positive
+s
+7
+natural
+s
+6
+signed
+s
+8
+unsigned
+s
+4
+line
+s
+4
+text
+s
+9
+std_logic
+s
+16
+std_logic_vector
+s
+10
+std_ulogic
+s
+17
+std_ulogic_vector
+s
+10
+qsim_state
+s
+17
+qsim_state_vector
+s
+12
+qsim_12state
+s
+19
+qsim_12state_vector
+s
+13
+qsim_strength
+s
+7
+mux_bit
+s
+10
+mux_vector
+s
+7
+reg_bit
+s
+10
+reg_vector
+s
+7
+wor_bit
+s
+10
+wor_vector
+x
+20
+PREDEFINED_CONSTANTS
+x
+10
+IDENT_KIND
+x
+7
+CodeRay
+n
+x
+20
+CaseIgnoringWordList
+x
+3
+new
+x
+8
+allocate
+x
+5
+ident
+x
+10
+initialize
+n
+x
+8
+reserved
+x
+3
+add
+n
+x
+8
+pre_type
+n
+x
+12
+pre_constant
+x
+6
+ESCAPE
+n
+x
+6
+Regexp
+s
+49
+ [rbfntv\n\\'"] | x[a-fA-F0-9]{1,2} | [0-7]{1,3}
+x
+14
+UNICODE_ESCAPE
+n
+s
+35
+ u[a-fA-F0-9]{4} | U[a-fA-F0-9]{8}
+x
+11
+scan_tokens
+M
+1
+n
+n
+x
+11
+scan_tokens
+i
+688
+7
+0
+19
+2
+15
+5
+47
+49
+1
+0
+10
+660
+1
+19
+3
+15
+1
+19
+4
+15
+20
+2
+13
+7
+0
+12
+49
+2
+1
+9
+331
+15
+5
+7
+3
+13
+70
+9
+51
+15
+44
+43
+4
+7
+5
+80
+49
+6
+2
+6
+3
+47
+49
+7
+1
+9
+63
+7
+8
+19
+3
+8
+329
+5
+7
+9
+13
+70
+9
+82
+15
+44
+43
+4
+7
+10
+80
+49
+6
+2
+6
+9
+47
+49
+7
+1
+9
+94
+7
+11
+19
+3
+8
+329
+5
+7
+12
+13
+70
+9
+113
+15
+44
+43
+4
+7
+13
+80
+49
+6
+2
+6
+12
+47
+49
+7
+1
+9
+125
+7
+14
+19
+3
+8
+329
+5
+7
+15
+13
+70
+9
+144
+15
+44
+43
+4
+7
+16
+80
+49
+6
+2
+6
+15
+47
+49
+7
+1
+19
+4
+9
+167
+45
+17
+18
+20
+4
+49
+19
+0
+49
+20
+1
+19
+3
+8
+329
+5
+7
+21
+13
+70
+9
+186
+15
+44
+43
+4
+7
+22
+79
+49
+6
+2
+6
+21
+47
+49
+7
+1
+19
+4
+9
+217
+20
+0
+7
+23
+7
+24
+35
+2
+49
+25
+1
+15
+7
+24
+19
+2
+15
+7
+26
+19
+3
+8
+329
+5
+7
+27
+13
+70
+9
+247
+15
+44
+43
+4
+7
+28
+45
+29
+30
+47
+49
+31
+0
+7
+32
+63
+3
+80
+49
+6
+2
+6
+27
+47
+49
+7
+1
+9
+259
+7
+33
+19
+3
+8
+329
+5
+7
+34
+13
+70
+9
+278
+15
+44
+43
+4
+7
+35
+78
+49
+6
+2
+6
+34
+47
+49
+7
+1
+9
+290
+7
+36
+19
+3
+8
+329
+5
+7
+37
+13
+70
+9
+309
+15
+44
+43
+4
+7
+38
+78
+49
+6
+2
+6
+37
+47
+49
+7
+1
+9
+321
+7
+39
+19
+3
+8
+329
+5
+48
+40
+15
+7
+41
+19
+3
+8
+564
+13
+7
+24
+12
+49
+2
+1
+9
+553
+15
+5
+7
+42
+13
+70
+9
+360
+15
+44
+43
+4
+7
+43
+78
+49
+6
+2
+6
+42
+47
+49
+7
+1
+9
+372
+7
+44
+19
+3
+8
+551
+5
+7
+45
+13
+70
+9
+391
+15
+44
+43
+4
+7
+46
+78
+49
+6
+2
+6
+45
+47
+49
+7
+1
+9
+432
+20
+0
+7
+46
+64
+7
+26
+35
+2
+49
+25
+1
+15
+20
+0
+7
+47
+7
+24
+35
+2
+49
+25
+1
+15
+7
+0
+19
+2
+15
+1
+8
+656
+8
+551
+5
+7
+48
+13
+70
+9
+472
+15
+44
+43
+4
+7
+49
+45
+29
+50
+47
+49
+31
+0
+7
+51
+45
+52
+53
+47
+49
+31
+0
+7
+54
+63
+5
+4
+6
+49
+6
+2
+6
+48
+47
+49
+7
+1
+9
+484
+7
+33
+19
+3
+8
+551
+5
+7
+55
+13
+70
+9
+503
+15
+44
+43
+4
+7
+56
+80
+49
+6
+2
+6
+55
+47
+49
+7
+1
+9
+532
+20
+0
+7
+47
+7
+24
+35
+2
+49
+25
+1
+15
+7
+41
+19
+3
+15
+7
+0
+19
+2
+8
+551
+5
+7
+57
+64
+5
+79
+47
+49
+58
+1
+49
+59
+1
+20
+0
+47
+49
+60
+2
+8
+564
+15
+5
+7
+61
+64
+20
+0
+47
+49
+60
+2
+15
+20
+4
+13
+10
+576
+15
+5
+48
+62
+19
+4
+15
+99
+43
+63
+7
+64
+49
+20
+1
+13
+9
+597
+15
+20
+3
+10
+596
+2
+8
+597
+3
+9
+625
+5
+7
+65
+64
+20
+4
+20
+3
+35
+2
+5
+48
+66
+35
+2
+49
+59
+1
+20
+0
+47
+49
+60
+2
+8
+626
+1
+15
+20
+4
+9
+634
+1
+8
+644
+5
+7
+67
+64
+20
+0
+47
+49
+60
+2
+15
+20
+0
+20
+4
+20
+3
+35
+2
+49
+25
+1
+15
+68
+8
+5
+1
+15
+20
+2
+7
+24
+83
+68
+9
+683
+20
+0
+7
+47
+7
+24
+35
+2
+49
+25
+1
+8
+684
+1
+15
+20
+0
+11
+I
+c
+I
+5
+I
+2
+I
+2
+n
+p
+69
+x
+7
+initial
+x
+4
+eos?
+x
+3
+===
+n
+x
+6
+Regexp
+s
+12
+ \s+ | \\\n
+x
+3
+new
+x
+4
+scan
+x
+5
+space
+n
+s
+5
+-- .*
+x
+7
+comment
+n
+s
+42
+ [-+*\/=<>?:;,!&^|()\[\]{}~%]+ | \.(?!\d)
+x
+8
+operator
+n
+s
+24
+ [A-Za-z_][A-Za-z_0-9]*
+x
+10
+IDENT_KIND
+n
+x
+8
+downcase
+x
+2
+[]
+n
+s
+7
+[a-z]?"
+x
+4
+open
+x
+6
+string
+x
+2
+<<
+x
+9
+delimiter
+n
+s
+24
+ L?' (?: [^\'\n\\] | \\
+x
+6
+ESCAPE
+n
+x
+4
+to_s
+s
+7
+ )? '?
+x
+4
+char
+n
+s
+18
+(?:\d+)(?![.eEfF])
+x
+7
+integer
+n
+s
+59
+\d[fF]?|\d*\.\d+(?:[eE][+-]?\d+)?[fF]?|\d+[eE][+-]?\d+[fF]?
+x
+5
+float
+x
+5
+getch
+x
+5
+error
+n
+s
+9
+[^\\\n"]+
+x
+7
+content
+n
+s
+1
+"
+x
+5
+close
+n
+s
+8
+ \\ (?:
+n
+s
+3
+ |
+x
+14
+UNICODE_ESCAPE
+n
+s
+3
+ )
+n
+s
+8
+ \\ | $
+s
+36
+else case " reached; %p not handled.
+x
+4
+peek
+x
+1
+%
+x
+13
+raise_inspect
+s
+13
+Unknown state
+x
+7
+matched
+x
+7
+Globals
+x
+6
+$DEBUG
+s
+25
+Error token %p in line %d
+x
+4
+line
+s
+11
+Empty token
+x
+2
+==
+p
+111
+I
+0
+I
+28
+I
+0
+I
+2a
+I
+5
+I
+2c
+I
+c
+I
+2e
+I
+10
+I
+2f
+I
+14
+I
+31
+I
+17
+I
+33
+I
+20
+I
+35
+I
+39
+I
+36
+I
+3f
+I
+38
+I
+58
+I
+39
+I
+5e
+I
+3b
+I
+77
+I
+3c
+I
+7d
+I
+3e
+I
+98
+I
+3f
+I
+a7
+I
+41
+I
+c2
+I
+42
+I
+ce
+I
+43
+I
+d3
+I
+44
+I
+d9
+I
+46
+I
+fd
+I
+47
+I
+103
+I
+49
+I
+11c
+I
+4a
+I
+122
+I
+4c
+I
+13b
+I
+4d
+I
+141
+I
+50
+I
+145
+I
+51
+I
+14c
+I
+55
+I
+155
+I
+56
+I
+16e
+I
+57
+I
+174
+I
+58
+I
+18d
+I
+59
+I
+19a
+I
+5a
+I
+1a6
+I
+5b
+I
+1ab
+I
+5c
+I
+1b0
+I
+5d
+I
+1de
+I
+5e
+I
+1e4
+I
+5f
+I
+1fd
+I
+60
+I
+209
+I
+61
+I
+20e
+I
+62
+I
+214
+I
+64
+I
+22a
+I
+68
+I
+235
+I
+6c
+I
+241
+I
+6d
+I
+257
+I
+6f
+I
+258
+I
+6e
+I
+25b
+I
+6f
+I
+271
+I
+6d
+I
+273
+I
+71
+I
+285
+I
+73
+I
+296
+I
+77
+I
+29e
+I
+78
+I
+2ab
+I
+77
+I
+2ad
+I
+7b
+I
+2b0
+x
+54
+/Users/murphy/ruby/coderay-0.9/test/functional/vhdl.rb
+p
+5
+x
+6
+tokens
+x
+7
+options
+x
+5
+state
+x
+4
+kind
+x
+5
+match
+x
+17
+method_visibility
+x
+15
+add_defn_method
+p
+65
+I
+2
+I
+3
+I
+a
+I
+5
+I
+d
+I
+6
+I
+22
+I
+7
+I
+3a
+I
+8
+I
+55
+I
+9
+I
+6d
+I
+a
+I
+85
+I
+b
+I
+a3
+I
+c
+I
+bb
+I
+d
+I
+d3
+I
+e
+I
+ee
+I
+f
+I
+109
+I
+10
+I
+115
+I
+11
+I
+11e
+I
+14
+I
+121
+I
+15
+I
+139
+I
+16
+I
+14e
+I
+17
+I
+15d
+I
+18
+I
+169
+I
+19
+I
+181
+I
+1c
+I
+184
+I
+1e
+I
+18a
+I
+20
+I
+1ab
+I
+21
+I
+1b0
+I
+20
+I
+1b3
+I
+22
+I
+1b8
+I
+20
+I
+1bb
+I
+23
+I
+1c0
+I
+20
+I
+1c7
+I
+25
+I
+1e0
+I
+26
+I
+1f9
+I
+28
+I
+207
+x
+54
+/Users/murphy/ruby/coderay-0.9/test/functional/vhdl.rb
+p
+0
+x
+13
+attach_method
+p
+3
+I
+0
+I
+1
+I
+23
+x
+54
+/Users/murphy/ruby/coderay-0.9/test/functional/vhdl.rb
+p
+0
diff --git a/vendor/gems/coderay-0.9.7/test/functional/word_list.rb b/vendor/gems/coderay-0.9.7/test/functional/word_list.rb
new file mode 100644
index 00000000..84d6e9e7
--- /dev/null
+++ b/vendor/gems/coderay-0.9.7/test/functional/word_list.rb
@@ -0,0 +1,79 @@
+require 'test/unit'
+require 'coderay'
+
+class WordListTest < Test::Unit::TestCase
+
+ include CodeRay
+
+ # define word arrays
+ RESERVED_WORDS = %w[
+ asm break case continue default do else
+ ...
+ ]
+
+ PREDEFINED_TYPES = %w[
+ int long short char void
+ ...
+ ]
+
+ PREDEFINED_CONSTANTS = %w[
+ EOF NULL ...
+ ]
+
+ # make a WordList
+ IDENT_KIND = WordList.new(:ident).
+ add(RESERVED_WORDS, :reserved).
+ add(PREDEFINED_TYPES, :pre_type).
+ add(PREDEFINED_CONSTANTS, :pre_constant)
+
+ def test_word_list_example
+ assert_equal :pre_type, IDENT_KIND['void']
+ # assert_equal :pre_constant, IDENT_KIND['...'] # not specified
+ end
+
+ def test_word_list
+ list = WordList.new(:ident).add(['foobar'], :reserved)
+ assert_equal :reserved, list['foobar']
+ assert_equal :ident, list['FooBar']
+ end
+
+ def test_word_list_cached
+ list = WordList.new(:ident, true).add(['foobar'], :reserved)
+ assert_equal :reserved, list['foobar']
+ assert_equal :ident, list['FooBar']
+ end
+
+ def test_case_ignoring_word_list
+ list = CaseIgnoringWordList.new(:ident).add(['foobar'], :reserved)
+ assert_equal :ident, list['foo']
+ assert_equal :reserved, list['foobar']
+ assert_equal :reserved, list['FooBar']
+
+ list = CaseIgnoringWordList.new(:ident).add(['FooBar'], :reserved)
+ assert_equal :ident, list['foo']
+ assert_equal :reserved, list['foobar']
+ assert_equal :reserved, list['FooBar']
+ end
+
+ def test_case_ignoring_word_list_cached
+ list = CaseIgnoringWordList.new(:ident, true).add(['foobar'], :reserved)
+ assert_equal :ident, list['foo']
+ assert_equal :reserved, list['foobar']
+ assert_equal :reserved, list['FooBar']
+
+ list = CaseIgnoringWordList.new(:ident, true).add(['FooBar'], :reserved)
+ assert_equal :ident, list['foo']
+ assert_equal :reserved, list['foobar']
+ assert_equal :reserved, list['FooBar']
+ end
+
+ def test_dup
+ list = WordList.new(:ident).add(['foobar'], :reserved)
+ assert_equal :reserved, list['foobar']
+ list2 = list.dup
+ list2.add(%w[foobar], :keyword)
+ assert_equal :keyword, list2['foobar']
+ assert_equal :reserved, list['foobar']
+ end
+
+end
\ No newline at end of file
diff --git a/vendor/gems/coderay-0.9.7/test/functional/word_list.rbc b/vendor/gems/coderay-0.9.7/test/functional/word_list.rbc
new file mode 100644
index 00000000..37bcdd28
--- /dev/null
+++ b/vendor/gems/coderay-0.9.7/test/functional/word_list.rbc
@@ -0,0 +1,1763 @@
+!RBIX
+0
+x
+M
+1
+n
+n
+x
+10
+__script__
+i
+53
+5
+7
+0
+64
+47
+49
+1
+1
+15
+5
+7
+2
+64
+47
+49
+1
+1
+15
+99
+7
+3
+45
+4
+5
+43
+6
+43
+7
+65
+49
+8
+3
+13
+99
+12
+7
+9
+12
+7
+10
+12
+65
+12
+49
+11
+4
+15
+49
+9
+0
+15
+2
+11
+I
+6
+I
+0
+I
+0
+I
+0
+n
+p
+12
+s
+9
+test/unit
+x
+7
+require
+s
+7
+coderay
+x
+12
+WordListTest
+x
+4
+Test
+n
+x
+4
+Unit
+x
+8
+TestCase
+x
+10
+open_class
+x
+14
+__class_init__
+M
+1
+n
+n
+x
+12
+WordListTest
+i
+232
+5
+66
+5
+45
+0
+1
+47
+49
+2
+1
+15
+65
+7
+3
+7
+4
+64
+7
+5
+64
+7
+6
+64
+7
+7
+64
+7
+8
+64
+7
+9
+64
+7
+10
+64
+7
+11
+64
+35
+8
+49
+12
+2
+15
+65
+7
+13
+7
+14
+64
+7
+15
+64
+7
+16
+64
+7
+17
+64
+7
+18
+64
+7
+11
+64
+35
+6
+49
+12
+2
+15
+65
+7
+19
+7
+20
+64
+7
+21
+64
+7
+11
+64
+35
+3
+49
+12
+2
+15
+65
+7
+22
+45
+23
+24
+13
+71
+25
+47
+9
+115
+47
+49
+26
+0
+13
+7
+27
+47
+49
+28
+1
+15
+8
+120
+7
+27
+49
+25
+1
+45
+3
+29
+7
+30
+49
+31
+2
+45
+13
+32
+7
+33
+49
+31
+2
+45
+19
+34
+7
+35
+49
+31
+2
+49
+12
+2
+15
+99
+7
+36
+7
+37
+65
+67
+49
+38
+0
+49
+39
+4
+15
+99
+7
+40
+7
+41
+65
+67
+49
+38
+0
+49
+39
+4
+15
+99
+7
+42
+7
+43
+65
+67
+49
+38
+0
+49
+39
+4
+15
+99
+7
+44
+7
+45
+65
+67
+49
+38
+0
+49
+39
+4
+15
+99
+7
+46
+7
+47
+65
+67
+49
+38
+0
+49
+39
+4
+15
+99
+7
+48
+7
+49
+65
+67
+49
+38
+0
+49
+39
+4
+11
+I
+a
+I
+0
+I
+0
+I
+0
+n
+p
+50
+x
+7
+CodeRay
+n
+x
+7
+include
+x
+14
+RESERVED_WORDS
+s
+3
+asm
+s
+5
+break
+s
+4
+case
+s
+8
+continue
+s
+7
+default
+s
+2
+do
+s
+4
+else
+s
+3
+...
+x
+9
+const_set
+x
+16
+PREDEFINED_TYPES
+s
+3
+int
+s
+4
+long
+s
+5
+short
+s
+4
+char
+s
+4
+void
+x
+20
+PREDEFINED_CONSTANTS
+s
+3
+EOF
+s
+4
+NULL
+x
+10
+IDENT_KIND
+x
+8
+WordList
+n
+x
+3
+new
+x
+8
+allocate
+x
+5
+ident
+x
+10
+initialize
+n
+x
+8
+reserved
+x
+3
+add
+n
+x
+8
+pre_type
+n
+x
+12
+pre_constant
+x
+22
+test_word_list_example
+M
+1
+n
+n
+x
+22
+test_word_list_example
+i
+17
+5
+7
+0
+45
+1
+2
+7
+3
+64
+49
+4
+1
+47
+49
+5
+2
+11
+I
+4
+I
+0
+I
+0
+I
+0
+n
+p
+6
+x
+8
+pre_type
+x
+10
+IDENT_KIND
+n
+s
+4
+void
+x
+2
+[]
+x
+12
+assert_equal
+p
+5
+I
+0
+I
+1d
+I
+0
+I
+1e
+I
+11
+x
+59
+/Users/murphy/ruby/coderay-0.9/test/functional/word_list.rb
+p
+0
+x
+17
+method_visibility
+x
+15
+add_defn_method
+x
+14
+test_word_list
+M
+1
+n
+n
+x
+14
+test_word_list
+i
+73
+45
+0
+1
+13
+71
+2
+47
+9
+23
+47
+49
+3
+0
+13
+7
+4
+47
+49
+5
+1
+15
+8
+28
+7
+4
+49
+2
+1
+7
+6
+64
+35
+1
+7
+7
+49
+8
+2
+19
+0
+15
+5
+7
+7
+20
+0
+7
+6
+64
+49
+9
+1
+47
+49
+10
+2
+15
+5
+7
+4
+20
+0
+7
+11
+64
+49
+9
+1
+47
+49
+10
+2
+11
+I
+5
+I
+1
+I
+0
+I
+0
+n
+p
+12
+x
+8
+WordList
+n
+x
+3
+new
+x
+8
+allocate
+x
+5
+ident
+x
+10
+initialize
+s
+6
+foobar
+x
+8
+reserved
+x
+3
+add
+x
+2
+[]
+x
+12
+assert_equal
+s
+6
+FooBar
+p
+9
+I
+0
+I
+22
+I
+0
+I
+23
+I
+29
+I
+24
+I
+39
+I
+25
+I
+49
+x
+59
+/Users/murphy/ruby/coderay-0.9/test/functional/word_list.rb
+p
+1
+x
+4
+list
+x
+21
+test_word_list_cached
+M
+1
+n
+n
+x
+21
+test_word_list_cached
+i
+75
+45
+0
+1
+13
+71
+2
+47
+9
+24
+47
+49
+3
+0
+13
+7
+4
+2
+47
+49
+5
+2
+15
+8
+30
+7
+4
+2
+49
+2
+2
+7
+6
+64
+35
+1
+7
+7
+49
+8
+2
+19
+0
+15
+5
+7
+7
+20
+0
+7
+6
+64
+49
+9
+1
+47
+49
+10
+2
+15
+5
+7
+4
+20
+0
+7
+11
+64
+49
+9
+1
+47
+49
+10
+2
+11
+I
+5
+I
+1
+I
+0
+I
+0
+n
+p
+12
+x
+8
+WordList
+n
+x
+3
+new
+x
+8
+allocate
+x
+5
+ident
+x
+10
+initialize
+s
+6
+foobar
+x
+8
+reserved
+x
+3
+add
+x
+2
+[]
+x
+12
+assert_equal
+s
+6
+FooBar
+p
+9
+I
+0
+I
+28
+I
+0
+I
+29
+I
+2b
+I
+2a
+I
+3b
+I
+2b
+I
+4b
+x
+59
+/Users/murphy/ruby/coderay-0.9/test/functional/word_list.rb
+p
+1
+x
+4
+list
+x
+28
+test_case_ignoring_word_list
+M
+1
+n
+n
+x
+28
+test_case_ignoring_word_list
+i
+178
+45
+0
+1
+13
+71
+2
+47
+9
+23
+47
+49
+3
+0
+13
+7
+4
+47
+49
+5
+1
+15
+8
+28
+7
+4
+49
+2
+1
+7
+6
+64
+35
+1
+7
+7
+49
+8
+2
+19
+0
+15
+5
+7
+4
+20
+0
+7
+9
+64
+49
+10
+1
+47
+49
+11
+2
+15
+5
+7
+7
+20
+0
+7
+6
+64
+49
+10
+1
+47
+49
+11
+2
+15
+5
+7
+7
+20
+0
+7
+12
+64
+49
+10
+1
+47
+49
+11
+2
+15
+45
+0
+13
+13
+71
+2
+47
+9
+112
+47
+49
+3
+0
+13
+7
+4
+47
+49
+5
+1
+15
+8
+117
+7
+4
+49
+2
+1
+7
+12
+64
+35
+1
+7
+7
+49
+8
+2
+19
+0
+15
+5
+7
+4
+20
+0
+7
+9
+64
+49
+10
+1
+47
+49
+11
+2
+15
+5
+7
+7
+20
+0
+7
+6
+64
+49
+10
+1
+47
+49
+11
+2
+15
+5
+7
+7
+20
+0
+7
+12
+64
+49
+10
+1
+47
+49
+11
+2
+11
+I
+5
+I
+1
+I
+0
+I
+0
+n
+p
+14
+x
+20
+CaseIgnoringWordList
+n
+x
+3
+new
+x
+8
+allocate
+x
+5
+ident
+x
+10
+initialize
+s
+6
+foobar
+x
+8
+reserved
+x
+3
+add
+s
+3
+foo
+x
+2
+[]
+x
+12
+assert_equal
+s
+6
+FooBar
+n
+p
+19
+I
+0
+I
+2e
+I
+0
+I
+2f
+I
+29
+I
+30
+I
+39
+I
+31
+I
+49
+I
+32
+I
+59
+I
+34
+I
+82
+I
+35
+I
+92
+I
+36
+I
+a2
+I
+37
+I
+b2
+x
+59
+/Users/murphy/ruby/coderay-0.9/test/functional/word_list.rb
+p
+1
+x
+4
+list
+x
+35
+test_case_ignoring_word_list_cached
+M
+1
+n
+n
+x
+35
+test_case_ignoring_word_list_cached
+i
+182
+45
+0
+1
+13
+71
+2
+47
+9
+24
+47
+49
+3
+0
+13
+7
+4
+2
+47
+49
+5
+2
+15
+8
+30
+7
+4
+2
+49
+2
+2
+7
+6
+64
+35
+1
+7
+7
+49
+8
+2
+19
+0
+15
+5
+7
+4
+20
+0
+7
+9
+64
+49
+10
+1
+47
+49
+11
+2
+15
+5
+7
+7
+20
+0
+7
+6
+64
+49
+10
+1
+47
+49
+11
+2
+15
+5
+7
+7
+20
+0
+7
+12
+64
+49
+10
+1
+47
+49
+11
+2
+15
+45
+0
+13
+13
+71
+2
+47
+9
+115
+47
+49
+3
+0
+13
+7
+4
+2
+47
+49
+5
+2
+15
+8
+121
+7
+4
+2
+49
+2
+2
+7
+12
+64
+35
+1
+7
+7
+49
+8
+2
+19
+0
+15
+5
+7
+4
+20
+0
+7
+9
+64
+49
+10
+1
+47
+49
+11
+2
+15
+5
+7
+7
+20
+0
+7
+6
+64
+49
+10
+1
+47
+49
+11
+2
+15
+5
+7
+7
+20
+0
+7
+12
+64
+49
+10
+1
+47
+49
+11
+2
+11
+I
+5
+I
+1
+I
+0
+I
+0
+n
+p
+14
+x
+20
+CaseIgnoringWordList
+n
+x
+3
+new
+x
+8
+allocate
+x
+5
+ident
+x
+10
+initialize
+s
+6
+foobar
+x
+8
+reserved
+x
+3
+add
+s
+3
+foo
+x
+2
+[]
+x
+12
+assert_equal
+s
+6
+FooBar
+n
+p
+19
+I
+0
+I
+3a
+I
+0
+I
+3b
+I
+2b
+I
+3c
+I
+3b
+I
+3d
+I
+4b
+I
+3e
+I
+5b
+I
+40
+I
+86
+I
+41
+I
+96
+I
+42
+I
+a6
+I
+43
+I
+b6
+x
+59
+/Users/murphy/ruby/coderay-0.9/test/functional/word_list.rb
+p
+1
+x
+4
+list
+x
+8
+test_dup
+M
+1
+n
+n
+x
+8
+test_dup
+i
+110
+45
+0
+1
+13
+71
+2
+47
+9
+23
+47
+49
+3
+0
+13
+7
+4
+47
+49
+5
+1
+15
+8
+28
+7
+4
+49
+2
+1
+7
+6
+64
+35
+1
+7
+7
+49
+8
+2
+19
+0
+15
+5
+7
+7
+20
+0
+7
+6
+64
+49
+9
+1
+47
+49
+10
+2
+15
+20
+0
+49
+11
+0
+19
+1
+15
+20
+1
+7
+6
+64
+35
+1
+7
+12
+49
+8
+2
+15
+5
+7
+12
+20
+1
+7
+6
+64
+49
+9
+1
+47
+49
+10
+2
+15
+5
+7
+7
+20
+0
+7
+6
+64
+49
+9
+1
+47
+49
+10
+2
+11
+I
+6
+I
+2
+I
+0
+I
+0
+n
+p
+13
+x
+8
+WordList
+n
+x
+3
+new
+x
+8
+allocate
+x
+5
+ident
+x
+10
+initialize
+s
+6
+foobar
+x
+8
+reserved
+x
+3
+add
+x
+2
+[]
+x
+12
+assert_equal
+x
+3
+dup
+x
+7
+keyword
+p
+15
+I
+0
+I
+46
+I
+0
+I
+47
+I
+29
+I
+48
+I
+39
+I
+49
+I
+41
+I
+4a
+I
+4e
+I
+4b
+I
+5e
+I
+4c
+I
+6e
+x
+59
+/Users/murphy/ruby/coderay-0.9/test/functional/word_list.rb
+p
+2
+x
+4
+list
+x
+5
+list2
+p
+45
+I
+2
+I
+6
+I
+b
+I
+9
+I
+e
+I
+a
+I
+23
+I
+b
+I
+2c
+I
+e
+I
+2f
+I
+f
+I
+3e
+I
+10
+I
+47
+I
+13
+I
+4a
+I
+14
+I
+59
+I
+18
+I
+78
+I
+19
+I
+7d
+I
+18
+I
+80
+I
+1a
+I
+85
+I
+18
+I
+88
+I
+1b
+I
+8d
+I
+18
+I
+94
+I
+1d
+I
+a2
+I
+22
+I
+b0
+I
+28
+I
+be
+I
+2e
+I
+cc
+I
+3a
+I
+da
+I
+46
+I
+e8
+x
+59
+/Users/murphy/ruby/coderay-0.9/test/functional/word_list.rb
+p
+0
+x
+13
+attach_method
+p
+7
+I
+0
+I
+1
+I
+9
+I
+2
+I
+12
+I
+4
+I
+35
+x
+59
+/Users/murphy/ruby/coderay-0.9/test/functional/word_list.rb
+p
+0
diff --git a/vendor/plugins/awesome_nested_set/lib/awesome_nested_set.rb b/vendor/plugins/awesome_nested_set/lib/awesome_nested_set.rb
index 0229a8e5..fc5278d6 100644
--- a/vendor/plugins/awesome_nested_set/lib/awesome_nested_set.rb
+++ b/vendor/plugins/awesome_nested_set/lib/awesome_nested_set.rb
@@ -444,17 +444,19 @@ module CollectiveIdea #:nodoc:
# Prunes a branch off of the tree, shifting all of the elements on the right
# back to the left so the counts still work.
def prune_from_tree
- return if right.nil? || left.nil?
- diff = right - left + 1
+ return if right.nil? || left.nil? || !self.class.exists?(id)
delete_method = acts_as_nested_set_options[:dependent] == :destroy ?
:destroy_all : :delete_all
self.class.base_class.transaction do
+ reload_nested_set
nested_set_scope.send(delete_method,
["#{quoted_left_column_name} > ? AND #{quoted_right_column_name} < ?",
left, right]
)
+ reload_nested_set
+ diff = right - left + 1
nested_set_scope.update_all(
["#{quoted_left_column_name} = (#{quoted_left_column_name} - ?)", diff],
["#{quoted_left_column_name} >= ?", right]
|