Skip to content

Commit

Permalink
Add option to disable blueprint generate
Browse files Browse the repository at this point in the history
  • Loading branch information
Liam Baker committed Nov 29, 2017
1 parent 782086c commit 2789042
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 12 deletions.
25 changes: 13 additions & 12 deletions lib/ember-cli-helper-view.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -302,18 +302,19 @@ class EmberCliHelperView extends View

bestPath = legitPaths[0] || goodPaths[0]

unless legitPaths[0]
fileName = bestPath.split('/').pop().split('.')[0] if bestPath
if fileName
atom.confirm
message: 'The target file does\'t exist, would you like to generate it?'
detailedMessage: "Atom will generate the #{fileName} component"
buttons:
'Nah, don\'t do anything': -> null
'Yes please, generate it!': => @blueprintNewComponent(fileName)
'No thanks, just open single file': => @openOrGenerateFile(bestPath, pathUntilApp)
else
@openOrGenerateFile(bestPath, pathUntilApp);
if atom.config.get('ember-cli-helper.generateFromBlueprint')
unless legitPaths[0]
fileName = bestPath.split('/').pop().split('.')[0] if bestPath
if fileName
atom.confirm
message: 'The target file doesn\'t exist, would you like to generate it?'
detailedMessage: "Atom will generate the #{fileName} component"
buttons:
'Nah, don\'t do anything': -> null
'Yes please, generate it!': => @blueprintNewComponent(fileName)
'No thanks, just open single file': => @openOrGenerateFile(bestPath, pathUntilApp)
else
@openOrGenerateFile(bestPath, pathUntilApp);

blueprintNewComponent: (file) ->
if file
Expand Down
9 changes: 9 additions & 0 deletions lib/ember-cli-helper.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ module.exports =
emberCliHelperView: null

config:
generateFromBlueprint:
title: 'Enable generating from blueprint'
description: """
Offer to generate component from blueprint if corresponding
file not found
"""
type: 'boolean'
default: true

generateCoffeescript:
title: 'Generate CoffeeScript'
description: 'Enable to generate CoffeeScript files instead of JavaScript'
Expand Down

1 comment on commit 2789042

@caseywatts
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

Please sign in to comment.