Sha256: 2b44884172aacb2852b72df65f7474b4bf3f9713ee8578a51cc6c25d1303fdaf

Contents?: true

Size: 1.06 KB

Versions: 4

Compression:

Stored size: 1.06 KB

Contents

desc 'Convert all plists to json'
task 'plist2json' do
  require './lib/ver/plist'
  require 'json'

  # This could be improved by using proper dependencies.

  # first we need location of the plist files, that is specific for my machine,
  # but can be changed via env variables.
  # The directory should point to the root directory of the svn trunk checkout:
  # svn co http://svn.textmate.org/trunk/
  location = ENV['DIR'] || '/home/manveru/prog/textmate/'
  p location

  { 'Themes/*.{tmTheme,tmtheme}'          => 'lib/ver/theme',
    'Bundles/*.tmbundle/Syntaxes/*.plist' => 'lib/ver/syntax'
  }.each do |glob, destination|
    begin
      Dir.glob(File.join(location, glob)) do |path|
        basename = File.basename(path, File.extname(path))
        jsonname = File.join(destination, "#{basename}.json")

        puts "Conversion of #{path} to #{jsonname}"

        File.open jsonname, 'w+' do |io|
          io.write JSON.pretty_unparse(VER::Plist.parse_xml(path))
        end
      end
    rescue => ex
      p ex
      mkdir_p destination
      retry
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ver-2009.12.14 tasks/plist2json.rake
ver-2009.11.29 tasks/plist2json.rake
ver-2009.11.28 tasks/plist2json.rake
ver-2009.10.14 tasks/plist2json.rake