diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
commit | 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch) | |
tree | 46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/WebInspectorUI/Scripts/update-codemirror-resources.rb | |
parent | 32761a6cee1d0dee366b885b7b9c777e67885688 (diff) | |
download | WebKitGtk-tarball-master.tar.gz |
webkitgtk-2.16.5HEADwebkitgtk-2.16.5master
Diffstat (limited to 'Source/WebInspectorUI/Scripts/update-codemirror-resources.rb')
-rwxr-xr-x | Source/WebInspectorUI/Scripts/update-codemirror-resources.rb | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/Source/WebInspectorUI/Scripts/update-codemirror-resources.rb b/Source/WebInspectorUI/Scripts/update-codemirror-resources.rb new file mode 100755 index 000000000..2f158aaf9 --- /dev/null +++ b/Source/WebInspectorUI/Scripts/update-codemirror-resources.rb @@ -0,0 +1,69 @@ +#!/usr/bin/ruby + +require 'fileutils' + +if ARGV.size != 1 + puts "usage: #{File.basename $0} <codemirror-repo-path>" + exit 1 +end + +def verify_code_mirror_repository_path(path) + if !File.directory? path + puts "ERROR: Provided CodeMirror path is not a directory." + exit 1 + end + + Dir.chdir(path) do + results = `git config --list | grep 'codemirror/CodeMirror\.git'` + if $?.exitstatus != 0 || results.split("\n").empty? + puts "ERROR: Provided CodeMirror path does not appear to be a CodeMirror checkout." + exit 1 + end + end +end + +code_mirror_repository_path = File.expand_path ARGV[0] +verify_code_mirror_repository_path code_mirror_repository_path + +web_inspector_user_interface_path = File.expand_path File.join(File.dirname(__FILE__), "../UserInterface") +web_inspector_code_mirror_resources_path = File.join web_inspector_user_interface_path, "/External/CodeMirror" + +CODE_MIRROR_FILES_TO_COPY = %w( + LICENSE + addon/comment/comment.js + addon/display/placeholder.js + addon/edit/closebrackets.js + addon/edit/matchbrackets.js + addon/mode/overlay.js + addon/runmode/runmode.js + addon/search/searchcursor.js + addon/selection/mark-selection.js + keymap/sublime.js + lib/codemirror.css + lib/codemirror.js + mode/clojure/clojure.js + mode/coffeescript/coffeescript.js + mode/css/css.js + mode/htmlmixed/htmlmixed.js + mode/javascript/javascript.js + mode/livescript/livescript.js + mode/sass/sass.js + mode/sql/sql.js + mode/xml/xml.js +) + +all_success = true + +CODE_MIRROR_FILES_TO_COPY.each do |subpath| + from_path = File.join code_mirror_repository_path, subpath + to_path = File.join web_inspector_code_mirror_resources_path, File.basename(subpath) + begin + puts "Copying #{File.basename(subpath)}..." + FileUtils.cp from_path, to_path + rescue Exception => e + puts "WARNING: #{e}" + all_success = false + end +end + +exit all_success ? 0 : 1 |