Skip to content

Commit

Permalink
refactored package, added keymaps and menus
Browse files Browse the repository at this point in the history
  • Loading branch information
donaldpipowitch committed Mar 4, 2014
1 parent aa82d27 commit bb9d241
Show file tree
Hide file tree
Showing 10 changed files with 87 additions and 34 deletions.
1 change: 0 additions & 1 deletion .gitattributes

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.DS_Store
npm-debug.log
node_modules
20 changes: 0 additions & 20 deletions LICENSE

This file was deleted.

22 changes: 22 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
The MIT License (MIT)

Copyright (c) 2014 Donald Pipowitch

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
# Beautify

[Atom package](https://github.com/einars/js-beautify)

> [Beautify](https://github.com/mishoo/UglifyJS2) HTML, CSS and Javascript in Atom.
# atom-beautify package

[Beautify](https://github.com/einars/js-beautify) HTML, CSS and Javascript in Atom.

## Usage

Open the Command Palette, and type `Beautify`. This will beautify JS, HTML or CSS files. It will only beautify selected text, if a selection is found - if not, the whole file will be beautified.

You can also type `ctrl-alt-b` as a shortcut or click `Packages > Beautify` in the menu.

## License

Expand Down
11 changes: 11 additions & 0 deletions keymaps/atom-beautify.cson
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Keybindings require three things to be fully defined: A selector that is
# matched against the focused element, the keystroke and the command to
# execute.
#
# Below is a basic keybinding which registers on all platforms by applying to
# the root workspace element.

# For more detailed documentation see
# https://atom.io/docs/latest/advanced/keymaps
'.workspace .editor:not(.mini)':
'ctrl-alt-b': 'beautify'
File renamed without changes.
14 changes: 14 additions & 0 deletions menus/atom-beautify.cson
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# See https://atom.io/docs/latest/creating-a-package#menus for more details
'context-menu':
'.workspace .editor:not(.mini)':
'Enable atom-beautify': 'beautify'

'menu': [
{
'label': 'Packages'
'submenu': [
'label': 'Beautify'
'command': 'beautify'
]
}
]
15 changes: 7 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
{
"name": "beautify",
"name": "atom-beautify",
"main": "./lib/atom-beautify",
"version": "0.0.0",
"private": true,
"description": "Beautify HTML, CSS and Javascript in Atom",
"license": "MIT",
"activationEvents": ["beautify"],
"repository": "https://github.com/donaldpipowitch/atom-beautify",
"activationEvents": [
"beautify"
],
"license": "MIT",
"author": {
"name": "Donald Pipowitch",
"email": "[email protected]",
"url": "https://github.com/donaldpipowitch"
},
"engines": {
"atom": ">=0.50.0"
"atom": ">0.50.0"
},
"dependencies": {},
"devDependencies": {
"dependencies": {
"js-beautify": "~1.4.2"
}
}
29 changes: 29 additions & 0 deletions spec/atom-beautify-spec.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
AtomBeautify = require '../lib/atom-beautify'

# Use the command `window:run-package-specs` (cmd-alt-ctrl-p) to run specs.
#
# To run a specific `it` or `describe` block add an `f` to the front (e.g. `fit`
# or `fdescribe`). Remove the `f` to unfocus the block.

describe "AtomBeautify", ->
activationPromise = null

beforeEach ->
atom.workspaceView = new WorkspaceView
activationPromise = atom.packages.activatePackage('atomBeautify')

# describe "when the beautify event is triggered", ->
# it "attaches and then detaches the view", ->
# expect(atom.workspaceView.find('.atom-beautify')).not.toExist()
#
# # This is an activation event, triggering it will cause the package to be
# # activated.
# atom.workspaceView.trigger 'beautify'
#
# waitsForPromise ->
# activationPromise
#
# runs ->
# expect(atom.workspaceView.find('.atom-beautify')).toExist()
# atom.workspaceView.trigger 'beautify'
# expect(atom.workspaceView.find('.atom-beautify')).not.toExist()

0 comments on commit bb9d241

Please sign in to comment.