Rakefile in textpow1x-1.2.0 vs Rakefile in textpow1x-1.2.1

- old
+ new

@@ -4,15 +4,12 @@ task :default do sh "rspec spec/" end desc "Convert a plist to a .syntax file" -task :convert, :file do |t,args| - require 'plist' - require 'yaml' - yaml = Plist.parse_xml(args[:file]).to_yaml - File.open('out.syntax','w'){|f| f.write(yaml) } +task :convert, :in, :out do |t,args| + convert(args[:in], args[:out] || 'out.syntax') end rule /^version:bump:.*/ do |t| sh "git status | grep 'nothing to commit'" # ensure we are not dirty index = ['major', 'minor','patch'].index(t.name.split(':').last) @@ -23,6 +20,24 @@ version_parts[index] = version_parts[index].to_i + 1 new_version = version_parts * '.' File.open(file,'w'){|f| f.write(version_file.sub(old_version, new_version)) } sh "bundle && git add #{file} Gemfile.lock && git commit -m 'bump version to #{new_version}'" +end + +desc "update syntaxes from their original source" +task :update_syntax do + { + 'source.scss' => 'https://raw.github.com/kuroir/SCSS.tmbundle/master/Syntaxes/SCSS.tmLanguage' + }.each do |scope_name, url| + `curl '#{url}' > temp.plist` + convert('temp.plist', "lib/textpow/syntax/#{scope_name}.syntax") + `rm temp.plist` + end +end + +def convert(from, to) + require 'plist' + require 'yaml' + yaml = Plist.parse_xml(from).to_yaml + File.open(to,'w'){|f| f.write(yaml) } end