added atom package for 'timestamp' generation!
This commit is contained in:
parent
3e178a2763
commit
5c4ef785e7
12 changed files with 245 additions and 0 deletions
3
system/atom/iso8601-timestamp-mod/.npmignore
Normal file
3
system/atom/iso8601-timestamp-mod/.npmignore
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
.DS_Store
|
||||
npm-debug.log
|
||||
node_modules
|
||||
5
system/atom/iso8601-timestamp-mod/CHANGELOG.md
Normal file
5
system/atom/iso8601-timestamp-mod/CHANGELOG.md
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
## 0.1.1 - License author name correction
|
||||
|
||||
## 0.1.0 - First Release
|
||||
* Provides 'iso8601-timestamp:local' and 'iso8601-timestamp:iso'
|
||||
* Provides context menu local time
|
||||
20
system/atom/iso8601-timestamp-mod/LICENSE.md
Normal file
20
system/atom/iso8601-timestamp-mod/LICENSE.md
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
Copyright (c) 2015 John Gerrard Holland
|
||||
|
||||
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.
|
||||
10
system/atom/iso8601-timestamp-mod/README.md
Normal file
10
system/atom/iso8601-timestamp-mod/README.md
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
# a modified version of iso8601-timestamp package
|
||||
|
||||
2 keyboard shortcuts available
|
||||
|
||||
C-c C-d
|
||||
C-c d
|
||||
|
||||
manually install
|
||||
|
||||
don't forget to npm install @ ~/.atom/packages/iso8601-timestamp-mod/
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
# 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/behind-atom-keymaps-in-depth
|
||||
'atom-workspace':
|
||||
'ctrl-c ctrl-d': 'iso8601-timestamp:iso'
|
||||
'ctrl-c d': 'iso8601-timestamp:local'
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
module.exports =
|
||||
class Iso8601TimestampView
|
||||
constructor: (serializedState) ->
|
||||
# Create root element
|
||||
@element = document.createElement('div')
|
||||
@element.classList.add('iso8601-timestamp')
|
||||
|
||||
# Create message element
|
||||
message = document.createElement('div')
|
||||
message.textContent = "The Iso8601Timestamp package is Alive! It's ALIVE!"
|
||||
message.classList.add('message')
|
||||
@element.appendChild(message)
|
||||
|
||||
# Returns an object that can be retrieved when package is activated
|
||||
serialize: ->
|
||||
|
||||
# Tear down any state and detach
|
||||
destroy: ->
|
||||
@element.remove()
|
||||
|
||||
getElement: ->
|
||||
@element
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
Iso8601TimestampView = require './iso8601-timestamp-view'
|
||||
{CompositeDisposable} = require 'atom'
|
||||
|
||||
module.exports = Iso8601Timestamp =
|
||||
|
||||
activate: ->
|
||||
atom.commands.add 'atom-workspace', "iso8601-timestamp:iso", => @iso()
|
||||
atom.commands.add 'atom-workspace', "iso8601-timestamp:local", => @local()
|
||||
|
||||
iso: ->
|
||||
editor = atom.workspace.getActivePaneItem()
|
||||
moment = require 'moment'
|
||||
iso_time = moment().format('YYYYMMDDTHHmmssZZ_')
|
||||
editor.insertText(iso_time)
|
||||
|
||||
local: ->
|
||||
editor = atom.workspace.getActivePaneItem()
|
||||
moment = require 'moment'
|
||||
local_time = moment().format('YYYY/MM/DD, HH:mm:ss, ZZ')
|
||||
editor.insertText(local_time)
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
# See https://atom.io/docs/latest/hacking-atom-package-word-count#menus for more details
|
||||
'context-menu':
|
||||
'atom-text-editor': [
|
||||
{
|
||||
'label': 'Insert ISO 8601 local time'
|
||||
'command': 'iso8601-timestamp:local'
|
||||
}
|
||||
]
|
||||
'menu': [
|
||||
{
|
||||
'label': 'Packages'
|
||||
'submenu': [
|
||||
'label': 'ISO 8601 timestamp'
|
||||
'submenu': [
|
||||
{
|
||||
'label': 'Insert ISO time'
|
||||
'command': 'iso8601-timestamp:iso'
|
||||
},
|
||||
{
|
||||
'label': 'Insert local time'
|
||||
'command': 'iso8601-timestamp:local'
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
]
|
||||
52
system/atom/iso8601-timestamp-mod/package.json
Normal file
52
system/atom/iso8601-timestamp-mod/package.json
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
{
|
||||
"_from": "https://www.atom.io/api/packages/iso8601-timestamp/versions/0.1.1/tarball",
|
||||
"_id": "iso8601-timestamp@0.1.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-z/g3Ix3BDxaCruSUaGKLvK/0aVPVyPcjJanVDe+7HBvFrL4In9wAgegEtB9ni+jIMuRhCgM6YJmMdAGp9kyD9Q==",
|
||||
"_location": "/iso8601-timestamp",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "remote",
|
||||
"raw": "https://www.atom.io/api/packages/iso8601-timestamp/versions/0.1.1/tarball",
|
||||
"rawSpec": "https://www.atom.io/api/packages/iso8601-timestamp/versions/0.1.1/tarball",
|
||||
"saveSpec": "https://www.atom.io/api/packages/iso8601-timestamp/versions/0.1.1/tarball",
|
||||
"fetchSpec": "https://www.atom.io/api/packages/iso8601-timestamp/versions/0.1.1/tarball"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"#USER",
|
||||
"/"
|
||||
],
|
||||
"_resolved": "https://www.atom.io/api/packages/iso8601-timestamp/versions/0.1.1/tarball",
|
||||
"_shasum": "b4b2663b1f226415fb1e46e337950bd9f87f1ae6",
|
||||
"_spec": "https://www.atom.io/api/packages/iso8601-timestamp/versions/0.1.1/tarball",
|
||||
"_where": "/tmp/apm-install-dir-2021015-40948-1qub7ma.hfmtf",
|
||||
"activationCommands": {
|
||||
"atom-workspace": [
|
||||
"iso8601-timestamp:iso",
|
||||
"iso8601-timestamp:local"
|
||||
]
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/hollandjg/iso8601-timestamp/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"moment": "2.10.6",
|
||||
"moment-timezone": "0.4.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Atom package to insert ISO 8601 compliant timestamps",
|
||||
"engines": {
|
||||
"atom": ">=1.0.0 <2.0.0"
|
||||
},
|
||||
"homepage": "https://github.com/hollandjg/iso8601-timestamp#readme",
|
||||
"keywords": [],
|
||||
"license": "MIT",
|
||||
"main": "./lib/iso8601-timestamp",
|
||||
"name": "iso8601-timestamp",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/hollandjg/iso8601-timestamp.git"
|
||||
},
|
||||
"version": "0.1.1"
|
||||
}
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
Iso8601Timestamp = require '../lib/iso8601-timestamp'
|
||||
|
||||
# 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 "Iso8601Timestamp", ->
|
||||
[workspaceElement, activationPromise] = []
|
||||
|
||||
beforeEach ->
|
||||
workspaceElement = atom.views.getView(atom.workspace)
|
||||
activationPromise = atom.packages.activatePackage('iso8601-timestamp')
|
||||
|
||||
describe "when the iso8601-timestamp: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('.iso8601-timestamp')).not.toExist()
|
||||
|
||||
# This is an activation event, triggering it will cause the package to be
|
||||
# activated.
|
||||
atom.commands.dispatch workspaceElement, 'iso8601-timestamp:toggle'
|
||||
|
||||
waitsForPromise ->
|
||||
activationPromise
|
||||
|
||||
runs ->
|
||||
expect(workspaceElement.querySelector('.iso8601-timestamp')).toExist()
|
||||
|
||||
iso8601TimestampElement = workspaceElement.querySelector('.iso8601-timestamp')
|
||||
expect(iso8601TimestampElement).toExist()
|
||||
|
||||
iso8601TimestampPanel = atom.workspace.panelForItem(iso8601TimestampElement)
|
||||
expect(iso8601TimestampPanel.isVisible()).toBe true
|
||||
atom.commands.dispatch workspaceElement, 'iso8601-timestamp:toggle'
|
||||
expect(iso8601TimestampPanel.isVisible()).toBe false
|
||||
|
||||
it "hides and shows the view", ->
|
||||
# This test shows you an integration test testing at the view level.
|
||||
|
||||
# Attaching the workspaceElement to the DOM is required to allow the
|
||||
# `toBeVisible()` matchers to work. Anything testing visibility or focus
|
||||
# requires that the workspaceElement is on the DOM. Tests that attach the
|
||||
# workspaceElement to the DOM are generally slower than those off DOM.
|
||||
jasmine.attachToDOM(workspaceElement)
|
||||
|
||||
expect(workspaceElement.querySelector('.iso8601-timestamp')).not.toExist()
|
||||
|
||||
# This is an activation event, triggering it causes the package to be
|
||||
# activated.
|
||||
atom.commands.dispatch workspaceElement, 'iso8601-timestamp:toggle'
|
||||
|
||||
waitsForPromise ->
|
||||
activationPromise
|
||||
|
||||
runs ->
|
||||
# Now we can test for view visibility
|
||||
iso8601TimestampElement = workspaceElement.querySelector('.iso8601-timestamp')
|
||||
expect(iso8601TimestampElement).toBeVisible()
|
||||
atom.commands.dispatch workspaceElement, 'iso8601-timestamp:toggle'
|
||||
expect(iso8601TimestampElement).not.toBeVisible()
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
Iso8601TimestampView = require '../lib/iso8601-timestamp-view'
|
||||
|
||||
describe "Iso8601TimestampView", ->
|
||||
it "has one valid test", ->
|
||||
expect("life").toBe "easy"
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
// The ui-variables file is provided by base themes provided by Atom.
|
||||
//
|
||||
// See https://github.com/atom/atom-dark-ui/blob/master/styles/ui-variables.less
|
||||
// for a full listing of what's available.
|
||||
@import "ui-variables";
|
||||
|
||||
.iso8601-timestamp {
|
||||
}
|
||||
Loading…
Reference in a new issue