diff options
author | Kornelius Kalnbach <murphy@rubychan.de> | 2013-06-12 16:04:45 +0200 |
---|---|---|
committer | Kornelius Kalnbach <murphy@rubychan.de> | 2013-06-12 16:04:45 +0200 |
commit | 69246fc8ed0344eae4dab35286813a00010a08cb (patch) | |
tree | 9c4faf0bcc2bb53e7955aff0b139492ea04dbe2e /rake_tasks | |
parent | 34e823d709ce19a480dbd78e72e63ada0d3425fb (diff) | |
parent | 40bd2ef5d33d32c3b3987da1d115b717259819e4 (diff) | |
download | coderay-69246fc8ed0344eae4dab35286813a00010a08cb.tar.gz |
Merge branch 'master' into lua-scanner
Conflicts:
lib/coderay/token_kinds.rb
Diffstat (limited to 'rake_tasks')
-rw-r--r-- | rake_tasks/documentation.rake | 11 | ||||
-rw-r--r-- | rake_tasks/generator.rake | 27 |
2 files changed, 18 insertions, 20 deletions
diff --git a/rake_tasks/documentation.rake b/rake_tasks/documentation.rake index 0b7f810..d555022 100644 --- a/rake_tasks/documentation.rake +++ b/rake_tasks/documentation.rake @@ -14,12 +14,13 @@ Rake::RDocTask.new :doc do |rd| rd.main = 'lib/README'
rd.title = 'CodeRay Documentation'
- rd.options << '--line-numbers' << '--inline-source' << '--tab-width' << '2'
- rd.options << '--fmt' << ENV.fetch('format', 'html_coderay')
- require 'pathname'
- template = File.join ROOT, 'rake_helpers', 'coderay_rdoc_template.rb'
- rd.template = Pathname.new(template).expand_path.to_s
+ rd.options << '--line-numbers' << '--tab-width' << '2'
+ # rd.options << '--fmt' << ENV.fetch('format', 'html_coderay')
+ # require 'pathname'
+ # template = File.join ROOT, 'rake_helpers', 'coderay_rdoc_template.rb'
+ # rd.template = Pathname.new(template).expand_path.to_s
+ rd.main = 'README_INDEX.rdoc'
rd.rdoc_files.add 'README_INDEX.rdoc'
rd.rdoc_files.add Dir['lib']
rd.rdoc_dir = 'doc'
diff --git a/rake_tasks/generator.rake b/rake_tasks/generator.rake index 9f5c192..284adcb 100644 --- a/rake_tasks/generator.rake +++ b/rake_tasks/generator.rake @@ -1,11 +1,11 @@ namespace :generate do - desc 'generates a new scanner NAME=lang [ALT=alternative,plugin,ids] [EXT=file,extensions] [BASE=base lang] ' + desc 'generates a new scanner NAME=lang [ALT=alternative,plugin,ids] [EXT=file,extensions] [BASE=base lang]' task :scanner do raise 'I need a scanner name; use NAME=lang' unless scanner_class_name = ENV['NAME'] raise "Invalid lang: #{scanner_class_name}; use NAME=lang." unless /\A\w+\z/ === scanner_class_name - require 'active_support' + require 'active_support/all' lang = scanner_class_name.underscore - class_name = scanner_class_name.classify + class_name = scanner_class_name.camelize def scanner_file_for_lang lang File.join(LIB_ROOT, 'coderay', 'scanners', lang + '.rb') @@ -25,6 +25,7 @@ namespace :generate do File.open(scanner_file, 'w') do |file| file.write base_scanner. sub(/class \w+ < Scanner/, "class #{class_name} < Scanner"). + sub('# Scanner for JSON (JavaScript Object Notation).', "# A scanner for #{scanner_class_name}."). sub(/register_for :\w+/, "register_for :#{lang}"). sub(/file_extension '\S+'/, "file_extension '#{ENV.fetch('EXT', lang).split(',').first}'") end @@ -37,9 +38,9 @@ namespace :generate do test_suite_file = File.join(test_dir, 'suite.rb') unless File.exist? test_suite_file puts "Creating test suite file #{test_suite_file}..." - base_suite = File.read File.join(test_dir, '..', 'json', 'suite.rb') + base_suite = File.read File.join(test_dir, '..', 'ruby', 'suite.rb') File.open(test_suite_file, 'w') do |file| - file.write base_suite.sub(/class JSON/, "class #{class_name}") + file.write base_suite.sub(/class Ruby/, "class #{class_name}") end end @@ -51,7 +52,7 @@ namespace :generate do end end - if alternative_ids = ENV['ALT'] + if alternative_ids = ENV['ALT'] && alternative_ids != lang map_file = File.join(LIB_ROOT, 'coderay', 'scanners', '_map.rb') puts "Not automated. Remember to add your alternative plugin ids to #{map_file}:" for id in alternative_ids.split(',') @@ -59,17 +60,13 @@ namespace :generate do end end - print 'Add to SVN? [Y|n] ' + print 'Add to git? [Y|n] ' answer = $stdin.gets.chomp.downcase if answer.empty? || answer == 'y' - sh "svn add #{scanner_file}" - sh "svn add #{test_dir}" - svn_ignore = <<-SVN_IGNORE -*.actual.* -*.expected.html -*.debug.diff* - SVN_IGNORE - sh "svn pset svn:ignore '#{svn_ignore}' #{test_dir}" + sh "git add #{scanner_file}" + cd File.join('test', 'scanners') do + sh "git add #{lang}" + end end end end |