module SublimeDSL::SublimeText

Public Class Methods

order_config(files) click to toggle source

Order a series of config files like ST does:

  • Default/* first,

  • then packages alphabetically,

  • then User/Default*,

  • then User/* alphabetically.

# File lib/sublime_dsl/sublime_text.rb, line 40
def self.order_config(files)
  default, other = files.partition { |f| f.start_with?('Default') }
  user, other = other.partition { |f| f.start_with?('User') }
  user_default, user_other = user.partition { |f| f.start_with?('User/Default') }
  default.sort + other.sort + user_default.sort + user_other.sort
end
packages_dir() click to toggle source

Path to the Packages directory.

# File lib/sublime_dsl/sublime_text.rb, line 19
def self.packages_dir
  @packages_dir ||=
    case Tools.os
    when :Windows
      ENV['APPDATA'].gsub('\\', '/') << '/Sublime Text 2/Packages'
    when :OSX
      "~/Library/Application Support/Sublime Text 2/Packages"
    when :Linux
      "~/.config/sublime-text-2/Packages"
    else
      raise NotImplementedError,
        "don't know the location of Sublime Text packages on #{os}"
    end
end