From 3c9204e464259e5795fbbef0b9c694bec14faec1 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 3 Feb 2014 15:22:55 -0800 Subject: [PATCH] Remove convert-theme grunt task This is now handled by the --convert argument to the apm init command --- build/tasks/convert-theme.coffee | 102 ------------------------------- vendor/apm | 2 +- 2 files changed, 1 insertion(+), 103 deletions(-) delete mode 100644 build/tasks/convert-theme.coffee diff --git a/build/tasks/convert-theme.coffee b/build/tasks/convert-theme.coffee deleted file mode 100644 index e94370e16..000000000 --- a/build/tasks/convert-theme.coffee +++ /dev/null @@ -1,102 +0,0 @@ -path = require 'path' - -_ = require 'underscore-plus' -fs = require 'fs-plus' -{ScopeSelector} = require 'first-mate' - -module.exports = (grunt) -> - grunt.registerTask 'convert-theme', 'Convert a TextMate theme to an Atom theme', -> - if textMateThemePath = grunt.option('path') - textMateThemePath = path.resolve(textMateThemePath) - if grunt.file.isFile(textMateThemePath) - textMateTheme = new TextMateTheme(textMateThemePath) - themeName = path.basename(textMateThemePath, path.extname(textMateThemePath)) - atomThemePath = path.join(path.dirname(textMateThemePath), "#{themeName.toLowerCase()}-syntax.css") - grunt.file.write(atomThemePath, textMateTheme.getStylesheet()) - grunt.log.ok("Atom theme written to: #{atomThemePath}") - else - grunt.log.error("No theme file found at: #{textMateThemePath}") - false - else - grunt.log.error('Must specify --path=') - false - -class TextMateTheme - constructor: (@path) -> - @rulesets = [] - @buildRulesets() - - buildRulesets: -> - {settings} = fs.readPlistSync(@path) - @buildGlobalSettingsRulesets(settings[0]) - @buildScopeSelectorRulesets(settings[1..]) - - getStylesheet: -> - lines = [] - for {selector, properties} in @getRulesets() - lines.push("#{selector} {") - lines.push " #{name}: #{value};" for name, value of properties - lines.push("}\n") - lines.join('\n') - - getRulesets: -> @rulesets - - buildGlobalSettingsRulesets: ({settings}) -> - { background, foreground, caret, selection, lineHighlight } = settings - - @rulesets.push - selector: '.editor, .editor .gutter' - properties: - 'background-color': @translateColor(background) - 'color': @translateColor(foreground) - - @rulesets.push - selector: '.editor.is-focused .cursor' - properties: - 'border-color': @translateColor(caret) - - @rulesets.push - selector: '.editor.is-focused .selection .region' - properties: - 'background-color': @translateColor(selection) - - @rulesets.push - selector: '.editor.is-focused .line-number.cursor-line-no-selection, .editor.is-focused .line.cursor-line' - properties: - 'background-color': @translateColor(lineHighlight) - - buildScopeSelectorRulesets: (scopeSelectorSettings) -> - for { name, scope, settings } in scopeSelectorSettings - continue unless scope - @rulesets.push - comment: name - selector: @translateScopeSelector(scope) - properties: @translateScopeSelectorSettings(settings) - - translateScopeSelector: (textmateScopeSelector) -> - new ScopeSelector(textmateScopeSelector).toCssSelector() - - translateScopeSelectorSettings: ({ foreground, background, fontStyle }) -> - properties = {} - - if fontStyle - fontStyles = fontStyle.split(/\s+/) - properties['font-weight'] = 'bold' if _.contains(fontStyles, 'bold') - properties['font-style'] = 'italic' if _.contains(fontStyles, 'italic') - properties['text-decoration'] = 'underline' if _.contains(fontStyles, 'underline') - - properties['color'] = @translateColor(foreground) if foreground - properties['background-color'] = @translateColor(background) if background - properties - - translateColor: (textmateColor) -> - if textmateColor.length <= 7 - textmateColor - else - r = parseInt(textmateColor[1..2], 16) - g = parseInt(textmateColor[3..4], 16) - b = parseInt(textmateColor[5..6], 16) - a = parseInt(textmateColor[7..8], 16) - a = Math.round((a / 255.0) * 100) / 100 - - "rgba(#{r}, #{g}, #{b}, #{a})" diff --git a/vendor/apm b/vendor/apm index 97ca21abb..aaba79564 160000 --- a/vendor/apm +++ b/vendor/apm @@ -1 +1 @@ -Subproject commit 97ca21abb99e8201b57bbda226f6aff67b8cfd20 +Subproject commit aaba79564fbb58237cbec788f4499f6742d61a97