Skip to content

Commit

Permalink
Update file names from atom-sonic to sb-atom-sonic-pi, and prepare fo…
Browse files Browse the repository at this point in the history
…r v1.0 release
  • Loading branch information
SunderB committed Feb 26, 2018
1 parent 6aa6e8c commit a70c5b7
Show file tree
Hide file tree
Showing 13 changed files with 94 additions and 51 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# Releases of sunderb/sb-atom-sonic-pi
## 1.0 - First release of sunderb/sb-atom-sonic-pi
* Adjusted OSC code to send to Sonic Pi server, and optionally the Sonic Pi GUI (OSC messages sent to GUI appear in the cue log).
* Added save-and-play-file command, which saves the current file and tells Sonic Pi to play the file. This allows for playback of large buffers. This command can be activated using F5.
* Changed some key bindings (atom-sonic:stop used ctrl-s, which is used as save on many systems, so I changed that), see below for the key bindings.

# Releases from rkh/atom-sonic
## 0.3.2
## 0.3.1
## 0.3.0
## 0.1.0 - First Release
* Every feature added
* Every bug fixed
25 changes: 24 additions & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,27 @@
Copyright (c) 2015 <Your name here>
# Copyright notice for modifications of rkh/atom-sonic in sunderb/sb-atom-sonic-pi from 24/02/2018 to present
Copyright (c) 2018 SunderB

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.

# Copyright notice for rkh/atom-sonic
Copyright (c) 2015 rkh

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
Expand Down
17 changes: 11 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
# Sonic Pi Atom integration

This plugin allows remote controlling [Sonic Pi](http://sonic-pi.net/) via [Atom](https://atom.io/).
This plugin, which is forked from [rkh/atom-sonic](https://github.com/rkh/atom-sonic), allows remote controlling [Sonic Pi](http://sonic-pi.net/) via [Atom](https://atom.io/).

Sonic Pi is fun to play with, but its built-in editor is very rudimentary.
With this plugin, you can do all the live coding in Atom instead.

![sonic-pi-atom-screenshot](https://raw.githubusercontent.com/rkh/atom-sonic/master/screenshot.png)

## Requirements

Sonic Pi needs to be running in the background.

## Changes from rkh/atom-sonic
* Adjusted OSC code to send to Sonic Pi server, and optionally the Sonic Pi GUI (OSC messages sent to GUI appear in the cue log).
* Added save-and-play-file command, which saves the current file and tells Sonic Pi to play the file. This allows for playback of large buffers. This command can be activated using F5.
* Changed some key bindings (atom-sonic:stop used ctrl-s, which is used as save on many systems, so I changed that), see below for the key bindings.

I'm happy to contribute these changes to rkh/atom-sonic if wanted. :)

## Default Key Bindings

Key Binding | Action | Description
--------------|--------------------------------|-----------------
`ctrl-r` | `atom-sonic:play-file` | Sends content of the currently open buffer to Sonic Pi for instant playback.
`f5` | `atom-sonic:save-and-play-file`| Saves the file and tells Sonic Pi to play the file. Allows for playback of large buffers.
`ctrl-f5` | `atom-sonic:play-file` | Sends content of the currently open buffer to Sonic Pi for instant playback.
`f5` | `atom-sonic:save-and-play-file`| Saves the current file and tells Sonic Pi to play the file. Allows for playback of large buffers.
`ctrl-alt-r` | `atom-sonic:play-selection` | Sends currently selected text to Sonic Pi for instant playback.
`ctrl-s` | `atom-sonic:stop` | Tells Sonic Pi to stop all playback.
`ctrl-alt-s` | `atom-sonic:stop` | Tells Sonic Pi to stop all playback.
8 changes: 4 additions & 4 deletions keymaps/atom-sonic.cson → keymaps/sb-atom-sonic-pi.cson
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# For more detailed documentation see
# https://atom.io/docs/latest/behind-atom-keymaps-in-depth
'atom-workspace':
'ctrl-r': 'atom-sonic:play-file'
'f5': 'atom-sonic:save-and-play-file'
'ctrl-alt-r': 'atom-sonic:play-selection'
'ctrl-s': 'atom-sonic:stop'
'ctrl-f5': 'sb-atom-sonic-pi:play-file'
'f5': 'sb-atom-sonic-pi:save-and-play-file'
'ctrl-alt-r': 'sb-atom-sonic-pi:play-selection'
'ctrl-alt-s': 'sb-atom-sonic-pi:stop'
File renamed without changes.
14 changes: 7 additions & 7 deletions lib/atom-sonic.coffee → lib/sb-atom-sonic-pi.coffee
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{CompositeDisposable} = require 'atom'
osc = require 'node-osc'
provider = require './atom-sonic-autocomplete'
provider = require './sb-atom-sonic-pi-autocomplete'

module.exports = AtomSonic =
module.exports = sbAtomSonicPi =
config:
sendMessagesToGUI:
title: 'Send Messages To GUI'
Expand All @@ -14,10 +14,10 @@ module.exports = AtomSonic =
activate: (state) ->
@subscriptions = new CompositeDisposable
@subscriptions.add(atom.commands.add 'atom-workspace',
'atom-sonic:play-file': => @play('getText'),
'atom-sonic:save-and-play-file':=> @saveAndPlay(),
'atom-sonic:play-selection': => @play('getSelectedText'),
'atom-sonic:stop': => @stop())
'sb-atom-sonic-pi:play-file': => @play('getText'),
'sb-atom-sonic-pi:save-and-play-file':=> @saveAndPlay(),
'sb-atom-sonic-pi:play-selection': => @play('getSelectedText'),
'sb-atom-sonic-pi:stop': => @stop())

deactivate: ->
@subscriptions.dispose()
Expand All @@ -41,7 +41,7 @@ module.exports = AtomSonic =
atom.notifications.addInfo "Told Sonic Pi to stop playing."

send: (args...) ->
if atom.config.get('atom-sonic.sendMessagesToGUI') == true
if atom.config.get('sb-atom-sonic-pi.sendMessagesToGUI') == true
sp_gui = new osc.Client('localhost', 4559)
sp_gui.send args..., -> sp_gui.kill()
sp_server = new osc.Client('127.0.0.1', 4557)
Expand Down
10 changes: 7 additions & 3 deletions menus/atom-sonic.cson → menus/sb-atom-sonic-pi.cson
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,19 @@
'submenu': [
{
'label': 'Play File'
'command': 'atom-sonic:play-file'
'command': 'sb-atom-sonic-pi:play-file'
},
{
'label': 'Save and Play File'
'command': 'sb-atom-sonic-pi:save-and-play-file'
},
{
'label': 'Play Selection'
'command': 'atom-sonic:play-selection'
'command': 'sb-atom-sonic-pi:play-selection'
},
{
'label': 'Stop Playing'
'command': 'atom-sonic:stop'
'command': 'sb-atom-sonic-pi:stop'
}
]
]
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "atom-sonic",
"main": "./lib/atom-sonic",
"version": "0.3.2",
"description": "Sonic Pi Atom integration",
"name": "sb-atom-sonic-pi",
"main": "./lib/sb-atom-sonic-pi",
"version": "1.0.0",
"description": "Sonic Pi Atom integration. Based on rkh/atom-sonic.",
"keywords": [],
"providedServices": {
"autocomplete.provider": {
Expand All @@ -11,7 +11,7 @@
}
}
},
"repository": "https://github.com/rkh/atom-sonic",
"repository": "https://github.com/sunderb/sb-atom-sonic-pi",
"license": "MIT",
"engines": {
"atom": ">=1.0.0 <2.0.0"
Expand Down
Binary file removed screenshot.png
Binary file not shown.
5 changes: 0 additions & 5 deletions spec/atom-sonic-view-spec.coffee

This file was deleted.

38 changes: 19 additions & 19 deletions spec/atom-sonic-spec.coffee → spec/sb-atom-sonic-pi-spec.coffee
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
AtomSonic = require '../lib/atom-sonic'
sbAtomSonicPi = require '../lib/sb-atom-sonic-pi'

# 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 "AtomSonic", ->
describe "sbAtomSonicPi", ->
[workspaceElement, activationPromise] = []

beforeEach ->
workspaceElement = atom.views.getView(atom.workspace)
activationPromise = atom.packages.activatePackage('atom-sonic')
activationPromise = atom.packages.activatePackage('sb-atom-sonic-pi')

describe "when the atom-sonic:toggle event is triggered", ->
describe "when the sb-atom-sonic-pi:toggle event is triggered", ->
it "hides and shows the modal panel", ->
# Before the activation event the view is not on the DOM, and no panel
# has been created
expect(workspaceElement.querySelector('.atom-sonic')).not.toExist()
expect(workspaceElement.querySelector('.sb-atom-sonic-pi')).not.toExist()

# This is an activation event, triggering it will cause the package to be
# activated.
atom.commands.dispatch workspaceElement, 'atom-sonic:toggle'
atom.commands.dispatch workspaceElement, 'sb-atom-sonic-pi:toggle'

waitsForPromise ->
activationPromise

runs ->
expect(workspaceElement.querySelector('.atom-sonic')).toExist()
expect(workspaceElement.querySelector('.sb-atom-sonic-pi')).toExist()

atomSonicElement = workspaceElement.querySelector('.atom-sonic')
expect(atomSonicElement).toExist()
sbAtomSonicPiElement = workspaceElement.querySelector('.sb-atom-sonic-pi')
expect(sbAtomSonicPiElement).toExist()

atomSonicPanel = atom.workspace.panelForItem(atomSonicElement)
expect(atomSonicPanel.isVisible()).toBe true
atom.commands.dispatch workspaceElement, 'atom-sonic:toggle'
expect(atomSonicPanel.isVisible()).toBe false
sbAtomSonicPiPanel = atom.workspace.panelForItem(sbAtomSonicPiElement)
expect(sbAtomSonicPiPanel.isVisible()).toBe true
atom.commands.dispatch workspaceElement, 'sb-atom-sonic-pi:toggle'
expect(sbAtomSonicPiPanel.isVisible()).toBe false

it "hides and shows the view", ->
# This test shows you an integration test testing at the view level.
Expand All @@ -45,18 +45,18 @@ describe "AtomSonic", ->
# workspaceElement to the DOM are generally slower than those off DOM.
jasmine.attachToDOM(workspaceElement)

expect(workspaceElement.querySelector('.atom-sonic')).not.toExist()
expect(workspaceElement.querySelector('.sb-atom-sonic-pi')).not.toExist()

# This is an activation event, triggering it causes the package to be
# activated.
atom.commands.dispatch workspaceElement, 'atom-sonic:toggle'
atom.commands.dispatch workspaceElement, 'sb-atom-sonic-pi:toggle'

waitsForPromise ->
activationPromise

runs ->
# Now we can test for view visibility
atomSonicElement = workspaceElement.querySelector('.atom-sonic')
expect(atomSonicElement).toBeVisible()
atom.commands.dispatch workspaceElement, 'atom-sonic:toggle'
expect(atomSonicElement).not.toBeVisible()
sbAtomSonicPiElement = workspaceElement.querySelector('.sb-atom-sonic-pi')
expect(sbAtomSonicPiElement).toBeVisible()
atom.commands.dispatch workspaceElement, 'sb-atom-sonic-pi:toggle'
expect(sbAtomSonicPiElement).not.toBeVisible()
6 changes: 6 additions & 0 deletions spec/sb-atom-sonic-pi-view-spec.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
sbAtomSonicView = require '../lib/sb-atom-sonic-pi-view'

describe "sbAtomSonicView", ->
it "has one valid test", ->
expect("life").toBe "easy"
# I'm not sure why this test is here, but OK...
2 changes: 1 addition & 1 deletion styles/atom-sonic.less → styles/sb-atom-sonic-pi.less
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
// for a full listing of what's available.
@import "ui-variables";

.atom-sonic {
.sb-atom-sonic-pi {
}

0 comments on commit a70c5b7

Please sign in to comment.