From ca7c14e3b711e72ce578b9efdd45d0cf89e5646e Mon Sep 17 00:00:00 2001 From: Seongjae Lee Date: Sun, 27 Sep 2015 10:45:51 -0700 Subject: [PATCH] Rename notelink to interlink --- lib/{notelink.coffee => interlink.coffee} | 6 +++--- lib/notational-velocity.coffee | 6 +++--- spec/{notelink-spec.coffee => interlink-spec.coffee} | 12 ++++++------ 3 files changed, 12 insertions(+), 12 deletions(-) rename lib/{notelink.coffee => interlink.coffee} (89%) rename spec/{notelink-spec.coffee => interlink-spec.coffee} (90%) diff --git a/lib/notelink.coffee b/lib/interlink.coffee similarity index 89% rename from lib/notelink.coffee rename to lib/interlink.coffee index d835ad6..b66a5af 100644 --- a/lib/notelink.coffee +++ b/lib/interlink.coffee @@ -3,10 +3,10 @@ fs = require 'fs-plus' Utility = require './utility' module.exports = -class NoteLink +class Interlink constructor: -> @subscriptions = new CompositeDisposable - @subscriptions.add atom.commands.add 'atom-workspace', 'nvatom:openInterlink': => NoteLink.openInterlink() + @subscriptions.add atom.commands.add 'atom-workspace', 'nvatom:openInterlink': => Interlink.openInterlink() destroy: -> @subscriptions.dispose() @@ -16,7 +16,7 @@ class NoteLink return unless editor? return unless Utility.isNote(editor.getPath()) - noteTitle = NoteLink.getInterlinkUnderCursor(editor) + noteTitle = Interlink.getInterlinkUnderCursor(editor) return unless noteTitle? return unless noteTitle.length diff --git a/lib/notational-velocity.coffee b/lib/notational-velocity.coffee index b10e10b..762b11c 100644 --- a/lib/notational-velocity.coffee +++ b/lib/notational-velocity.coffee @@ -1,7 +1,7 @@ path = require 'path' fs = require 'fs-plus' {CompositeDisposable, Disposable} = require 'atom' -NoteLink = require './notelink' +Interlink = require './interlink' Utility = require './utility' module.exports = @@ -51,11 +51,11 @@ module.exports = @subscriptions.add atom.workspace.onWillDestroyPaneItem ({item}) => @autosave(item) unless @autodelete(item) - @noteLink = new NoteLink() + @interlink = new Interlink() deactivate: -> @subscriptions.dispose() - @noteLink.destroy() + @interlnk.destroy() @notationalVelocityView.destroy() serialize: -> diff --git a/spec/notelink-spec.coffee b/spec/interlink-spec.coffee similarity index 90% rename from spec/notelink-spec.coffee rename to spec/interlink-spec.coffee index 7695dc6..37acd1e 100644 --- a/spec/notelink-spec.coffee +++ b/spec/interlink-spec.coffee @@ -1,9 +1,9 @@ fs = require 'fs-plus' path = require 'path' temp = require 'temp' -NoteLink = require '../lib/notelink' +Interlink = require '../lib/interlink' -describe 'Notelink', -> +describe 'Interlink', -> defaultDirectory = atom.config.get('nvatom.directory') noteDirectory = null @@ -40,7 +40,7 @@ describe 'Notelink', -> for testitem in testdata editor.setText testitem.text editor.setCursorBufferPosition testitem.position - expect(NoteLink.getInterlinkUnderCursor(editor)).toBe testitem.expected + expect(Interlink.getInterlinkUnderCursor(editor)).toBe testitem.expected it 'returns undefined for invalid text', -> testdata = [ @@ -57,7 +57,7 @@ describe 'Notelink', -> for testitem in testdata editor.setText testitem.text editor.setCursorBufferPosition testitem.position - expect(NoteLink.getInterlinkUnderCursor(editor)).toBe undefined + expect(Interlink.getInterlinkUnderCursor(editor)).toBe undefined describe 'when openInterlink is called', -> describe 'when the editor path is under the note directory', -> @@ -71,7 +71,7 @@ describe 'Notelink', -> editor.setText '[[Car]]' editor.setCursorBufferPosition [0, 2] - editorPromise = NoteLink.openInterlink() + editorPromise = Interlink.openInterlink() expect(editorPromise).not.toBe undefined waitsForPromise -> editorPromise @@ -90,5 +90,5 @@ describe 'Notelink', -> editor.setText '[[Car]]' editor.setCursorBufferPosition [0, 2] - editorPromise = NoteLink.openInterlink() + editorPromise = Interlink.openInterlink() expect(editorPromise).toBe undefined