avoid reloading notebooklist three times on "Stop"

This commit is contained in:
dickmao 2020-02-01 20:16:29 -05:00
parent 6443937258
commit 0cb185dde6
8 changed files with 241 additions and 139 deletions

221
.appveyor.yml Normal file
View file

@ -0,0 +1,221 @@
version: 1.0.{build}
# you can use {branch} name in version format too
# version: 1.0.{build}-{branch}
# Do not build on tags (GitHub and BitBucket)
skip_tags: true
# Skipping commits with particular message or from specific user
skip_commits:
message: /\[skip appveyor\]/ # Regex for matching commit message
# Do not build feature branch with open Pull Requests
# skip_branch_with_pr: true
# Maximum number of concurrent jobs for the project
max_jobs: 1
# Build worker image (VM template)
image: Visual Studio 2015
# scripts that are called at very beginning, before repo cloning
init:
- git config --global core.autocrlf input
# clone directory
clone_folder: c:\projects\myproject
# fetch repository as zip archive
shallow_clone: true # default is "false"
# set clone depth
clone_depth: 5 # clone entire repository history if not defined
# setting up etc\hosts file
hosts:
queue-server: 127.0.0.1
db.server.com: 127.0.0.2
# environment variables
environment:
# this is how to set encrypted variable. Go to "Settings" -> "Encrypt YAML" page in account menu to encrypt data.
my_secure_var1:
secure: FW3tJ3fMncxvs58/ifSP7w==
# environment:
# global:
# connection_string: server=12;password=13;
# service_url: https://127.0.0.1:8090
#
# matrix:
# - db: mysql
# provider: mysql
#
# - db: mssql
# provider: mssql
# password:
# secure: $#(JFDA)jQ@#$
# this is how to allow failing jobs in the matrix
matrix:
fast_finish: true # set this flag to immediately finish build once one of the jobs fails.
allow_failures:
- platform: x86
configuration: Debug
- platform: x64
configuration: Release
# exclude configuration from the matrix. Works similarly to 'allow_failures' but build not even being started for excluded combination.
exclude:
- platform: x86
configuration: Debug
# build cache to preserve files/folders between builds
cache:
# - packages -> **\packages.config # preserve "packages" directory in the root of build folder but will reset it if packages.config is modified
- C:\python27\
- C:\ProgramData\chocolatey\lib
- C:\ProgramData\chocolatey\bin
# - '%LocalAppData%'
# - node_modules # local npm modules
- '%LocalAppData%\NuGet\Cache' # NuGet < v3
- '%LocalAppData%\NuGet\v3-cache' # NuGet v3
# enable service required for build/tests
#services:
# - mssql2014 # start SQL Server 2014 Express
# - mssql2014rs # start SQL Server 2014 Express and Reporting Services
# - mssql2012sp1 # start SQL Server 2012 SP1 Express
# - mssql2012sp1rs # start SQL Server 2012 SP1 Express and Reporting Services
# - mssql2008r2sp2 # start SQL Server 2008 R2 SP2 Express
# - mssql2008r2sp2rs # start SQL Server 2008 R2 SP2 Express and Reporting Services
# - mysql # start MySQL 5.6 service
# - postgresql # start PostgreSQL 9.5 service
# - iis # start IIS
# - msmq # start Queuing services
# - mongodb # start MongoDB
# scripts that run after cloning repository
# enable patching of AssemblyInfo.* files
# assembly_info:
# patch: true
# file: AssemblyInfo.*
# assembly_version: "2.2.{build}"
# assembly_file_version: "{version}"
# assembly_informational_version: "{version}"
# Automatically register private account and/or project AppVeyor NuGet feeds.
#nuget:
# account_feed: true
# project_feed: true
# disable_publish_on_pr: true # disable publishing of .nupkg artifacts to
# # account/project feeds for pull request builds
#---------------------------------#
# build configuration #
#---------------------------------#
# build platform, i.e. x86, x64, Any CPU. This setting is optional.
#platform: Any CPU
# to add several platforms to build matrix:
#platform:
# - x86
# - Any CPU
# build Configuration, i.e. Debug, Release, etc.
# configuration: Release
# to add several configurations to build matrix:
#configuration:
# - Debug
# - Release
# Build settings, not to be confused with "before_build" and "after_build".
# "project" is relative to the original build directory and not influenced by directory changes in "before_build".
#build:
# parallel: true # enable MSBuild parallel builds
# project: MyTestAzureCS.sln # path to Visual Studio solution or project
# publish_wap: true # package Web Application Projects (WAP) for Web Deploy
# publish_wap_xcopy: true # package Web Application Projects (WAP) for XCopy deployment
# publish_azure: true # package Azure Cloud Service projects and push to artifacts
# publish_nuget: true # package projects with .nuspec files and push to artifacts
# publish_nuget_symbols: true # generate and publish NuGet symbol packages
# include_nuget_references: true # add -IncludeReferencedProjects option while packaging NuGet artifacts
# MSBuild verbosity level
# verbosity: quiet|minimal|normal|detailed
# to disable automatic builds
build: off
#---------------------------------#
# tests configuration #
#---------------------------------#
# to run tests against only selected assemblies and/or categories
#test:
# assemblies:
# only:
# - asm1.dll
# - asm2.dll
#
# categories:
# only:
# - UI
# - E2E
# to run tests against all except selected assemblies and/or categories
#test:
# assemblies:
# except:
# - asm1.dll
# - asm2.dll
#
# categories:
# except:
# - UI
# - E2E
# to run tests from different categories as separate jobs in parallel
#test:
# categories:
# - A # A category common for all jobs
# - [UI] # 1st job
# - [DAL, BL] # 2nd job
# scripts to run before tests (working directory and environment changes are persisted from the previous steps such as "before_build")
before_test:
# to run your custom scripts instead of automatic tests
test_script:
- cd c:\projects\myproject
# - make quick
# scripts to run after tests
after_test:
# to disable automatic tests
test: off
# to disable deployment
deploy: off
#---------------------------------#
# global handlers #
#---------------------------------#
# on successful build
#on_success:
# on build failure
#on_failure:
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
# after build failure or success
on_finish:
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))

View file

@ -1,6 +1,9 @@
name: CI
on:
pull_request:
paths-ignore:
- '**.md'
push:
paths-ignore:
- '**.md'

View file

@ -58,8 +58,8 @@ Scenario: Delete closes buffers and sessions
Then eval "(should-not (ein:notebook-opened-notebooks)))"
Then eval "(should-not (seq-some (lambda (b) (cl-search "Untitled" (buffer-name b))) (buffer-list)))"
And I switch to log expr "ein:log-all-buffer-name"
Then I should see "kernel-delete-session--success"
Then I should see "notebooklist-delete-notebook--complete"
And I wait for buffer to say "kernel-delete-session--success"
And I wait for buffer to say "notebooklist-delete-notebook--complete"
@content
Scenario: Read a massive directory

View file

@ -375,12 +375,7 @@
(lambda ()
(let ((says (s-contains? (s-replace "\\n" "\n" bogey) (buffer-string))))
(aif (if negate (not says) says)
it
(when (with-current-buffer ein:log-all-buffer-name
(search "WS closed unexpectedly" (buffer-string)))
(And "I clear log expr \"ein:log-all-buffer-name\"")
(Then "I ctrl-c-ctrl-c"))
nil)))
it)))
nil 35000 2000)))
(When "^I wait for cell to execute$"

View file

@ -556,11 +556,11 @@ Example::
(ein:url url-or-port "api/sessions" session-id)
:type "DELETE"
:complete (apply-partially #'ein:kernel-delete-session--complete kernel session-id callback)
:error (apply-partially #'ein:kernel-delete-session--error session-id callback)
:error (apply-partially #'ein:kernel-delete-session--error session-id nil)
:success (apply-partially #'ein:kernel-delete-session--success session-id
(aif (ein:notebooklist-get-buffer url-or-port)
(buffer-local-value 'ein:%notebooklist% it))
callback))
nil))
(ein:log 'verbose "ein:kernel-delete-session: no sessions found for %s" path)
(when callback
(funcall callback kernel))))
@ -582,7 +582,7 @@ Example::
&key data response
&allow-other-keys
&aux (resp-string (format "STATUS: %s DATA: %s" (request-response-status-code response) data)))
(ein:log 'debug "ein:kernel-delete-session--complete %s" resp-string)
(ein:log 'verbose "ein:kernel-delete-session--complete %s" resp-string)
(when kernel
(ein:kernel-disconnect kernel))
(when callback (funcall callback kernel)))

View file

@ -545,13 +545,17 @@ This function is called via `ein:notebook-after-rename-hook'."
'link
:notify
(apply-partially
(lambda (callback* url-or-port* path* &rest _ignore)
(ein:message-whir
"Ending session" callback*
(ein:kernel-delete-session callback*
:url-or-port url-or-port*
:path path*)))
reloader url-or-port path)
(cl-function
(lambda (url-or-port*
path*
&rest _ignore
&aux (callback (lambda (_kernel) t)))
(ein:message-whir
"Ending session" callback
(ein:kernel-delete-session callback
:url-or-port url-or-port*
:path path*))))
url-or-port path)
"Stop")
(widget-insert "[----]"))
(widget-insert " ")

View file

@ -1,22 +0,0 @@
(setq utf-translate-cjk-mode nil) ; disable CJK coding/encoding (Chinese/Japanese/Korean characters)
(set-language-environment 'utf-8)
(set-keyboard-coding-system 'utf-8-mac) ; For old Carbon emacs on OS X only
(setq locale-coding-system 'utf-8)
(set-default-coding-systems 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-selection-coding-system
(if (eq system-type 'windows-nt)
'utf-16le-dos ;; https://rufflewind.com/2014-07-20/pasting-unicode-in-emacs-on-windows
'utf-8))
(prefer-coding-system 'utf-8)
;; (require 'package)
;; (setq package-enable-at-startup nil)
;; (setq package-archives
;; '(("melpa" . "https://raw.githubusercontent.com/d12frosted/elpa-mirror/master/melpa/")
;; ("org" . "https://raw.githubusercontent.com/d12frosted/elpa-mirror/master/org/")
;; ("gnu" . "https://raw.githubusercontent.com/d12frosted/elpa-mirror/master/gnu/")))
;; (package-initialize)
;; (unless (package-installed-p 'use-package)
;; (package-refresh-contents)
;; (package-install 'use-package))

View file

@ -1,99 +0,0 @@
#!/usr/bin/env python
# -*- coding: utf-8; -*-
# Copyright (C) 2012, 2013, 2014 Johan Andersson
# Copyright (C) 2013, 2014 Sebastian Wiesner
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with GNU Emacs; see the file COPYING. If not, write to the
# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.
"""
Install Cask
"""
from __future__ import print_function, unicode_literals
import errno
import os
import sys
from subprocess import CalledProcessError, check_call
HOME = os.path.expanduser('~')
TARGET_DIRECTORY = os.path.join(HOME, '.cask')
REPOSITORY = 'https://github.com/millejoh/cask.git'
ISSUE_TRACKER = 'https://github.com/cask/cask/issues'
class CaskGoError(Exception):
pass
OKGREEN = '\033[32m'
FAIL = '\033[31m'
ENDC = '\033[0m'
def success(s):
print(OKGREEN + s + ENDC)
sys.exit(0)
def fail(s):
print(FAIL + s + ENDC, file=sys.stderr)
sys.exit(1)
def bootstrap_cask(target_directory):
cask = os.path.join(target_directory, 'bin', 'cask')
try:
check_call([sys.executable, cask, 'eval', '(progn (setq package-check-signature nil) (cask-cli/upgrade-cask))'])
except CalledProcessError:
raise CaskGoError('Cask could not be bootstrapped. Try again later, '
'or report an issue at {0}'.format(ISSUE_TRACKER))
def install_cask(target_directory):
if os.path.isdir(target_directory):
raise CaskGoError(
'Directory {0} exists. Is Cask already installed?'.format(
target_directory))
else:
try:
check_call(['git', 'clone', '--branch', 'appveyor-build', REPOSITORY, target_directory])
except CalledProcessError:
raise CaskGoError('Cask could not be installed. Try again '
'later, or report an issue at {0}'.format(
ISSUE_TRACKER))
except OSError as error:
if error.errno == errno.ENOENT:
raise CaskGoError('git executable not found. Please install Git')
else:
raise
def main():
try:
install_cask(TARGET_DIRECTORY)
bootstrap_cask(TARGET_DIRECTORY)
success("""\
Successfully installed Cask! Now, add the cask binary to your $PATH:
export PATH="{0}/bin:$PATH\"""".format(TARGET_DIRECTORY))
except CaskGoError as error:
fail('{0!s}'.format(error))
if __name__ == '__main__':
sys.exit(main())