See #713. Extract General options from package settings

This commit is contained in:
Glavin Wiechert 2016-03-21 11:44:14 -03:00
parent 2be35ca657
commit 74526b6821
4 changed files with 11 additions and 11 deletions

View File

@ -121,7 +121,7 @@ module.exports = class Gherkin extends Beautifier
lexer = new Lexer(recorder) lexer = new Lexer(recorder)
lexer.scan(text) lexer.scan(text)
loggerLevel = atom?.config.get('atom-beautify._loggerLevel') loggerLevel = atom?.config.get('atom-beautify.general.loggerLevel')
if loggerLevel is 'verbose' if loggerLevel is 'verbose'
for line in recorder.lines for line in recorder.lines
logger.verbose("> #{line}") logger.verbose("> #{line}")

View File

@ -453,20 +453,20 @@ module.exports = class Beautifiers extends EventEmitter
) )
# Check if Analytics is enabled # Check if Analytics is enabled
if atom.config.get("atom-beautify.analytics") if atom.config.get("atom-beautify.general.analytics")
# Setup Analytics # Setup Analytics
analytics = new Analytics(analyticsWriteKey) analytics = new Analytics(analyticsWriteKey)
unless atom.config.get("atom-beautify._analyticsUserId") unless atom.config.get("atom-beautify.general.analyticsUserId")
uuid = require("node-uuid") uuid = require("node-uuid")
atom.config.set "atom-beautify._analyticsUserId", uuid.v4() atom.config.set "atom-beautify.general.analyticsUserId", uuid.v4()
# Setup Analytics User Id # Setup Analytics User Id
userId = atom.config.get("atom-beautify._analyticsUserId") userId = atom.config.get("atom-beautify.general.analyticsUserId")
analytics.identify userId : userId analytics.identify userId : userId
version = pkg.version version = pkg.version
analytics.track analytics.track
userId : atom.config.get("atom-beautify._analyticsUserId") userId : atom.config.get("atom-beautify.general.analyticsUserId")
event : "Beautify" event : "Beautify"
properties : properties :
language : language?.name language : language?.name
@ -478,7 +478,7 @@ module.exports = class Beautifiers extends EventEmitter
category : version category : version
if unsupportedGrammar if unsupportedGrammar
if atom.config.get("atom-beautify.muteUnsupportedLanguageErrors") if atom.config.get("atom-beautify.general.muteUnsupportedLanguageErrors")
return resolve( null ) return resolve( null )
else else
repoBugsUrl = pkg.bugs.url repoBugsUrl = pkg.bugs.url

View File

@ -58,7 +58,7 @@ beautifier.on('beautify::end', ->
) )
# Show error # Show error
showError = (error) -> showError = (error) ->
if not atom.config.get("atom-beautify.muteAllErrors") if not atom.config.get("atom-beautify.general.muteAllErrors")
# console.log(e) # console.log(e)
stack = error.stack stack = error.stack
detail = error.description or error.message detail = error.description or error.message
@ -84,7 +84,7 @@ beautify = ({onSave}) ->
# Continue beautifying # Continue beautifying
path ?= require("path") path ?= require("path")
forceEntireFile = onSave and atom.config.get("atom-beautify.beautifyEntireFileOnSave") forceEntireFile = onSave and atom.config.get("atom-beautify.general.beautifyEntireFileOnSave")
# Get the path to the config file # Get the path to the config file
# All of the options # All of the options

View File

@ -15,12 +15,12 @@ module.exports = {
used the most, as well as other stats. Everything is anonymized and no personal used the most, as well as other stats. Everything is anonymized and no personal
information, such as source code, is sent. information, such as source code, is sent.
See https://github.com/Glavin001/atom-beautify/issues/47 for more details." See https://github.com/Glavin001/atom-beautify/issues/47 for more details."
_analyticsUserId : analyticsUserId :
title: 'Analytics User Id' title: 'Analytics User Id'
type : 'string' type : 'string'
default : "" default : ""
description : "Unique identifier for this user for tracking usage analytics" description : "Unique identifier for this user for tracking usage analytics"
_loggerLevel : loggerLevel :
title: "Logger Level" title: "Logger Level"
type : 'string' type : 'string'
default : 'warn' default : 'warn'