I just discovered this behavior accidentally. It caught me off guard and feels unintuitive. And the negative of accidentally running it doesnt seem to outweigh having to type an extra "--link <dirname>" (especially after cloning, when you are not in the directory you just created anyways).
I doubt I'm going to change any minds though so at the very least this behavior should be mentioned in raco pkg install --help. On Mon, Oct 14, 2013 at 2:08 PM, <sa...@racket-lang.org> wrote: > samth has updated `master' from eca9e16b96 to 4a542969c7. > http://git.racket-lang.org/plt/eca9e16b96..4a542969c7 > > =====[ One Commit ]===================================================== > Directory summary: > 27.7% pkgs/racket-pkgs/racket-doc/pkg/scribblings/ > 54.1% racket/collects/pkg/ > 10.4% racket/collects/racket/ > > ~~~~~~~~~~ > > 4a54296 Sam Tobin-Hochstadt <sa...@racket-lang.org> 2013-09-26 17:37 > : > | Make 'raco pkg install' with no arguments install the current directory. > | > | This is useful for telling people how to install a new pkg, from > | GitHub or elsewhere: just get the files, and then do > | `raco pkg install` in the relevant directory. > | > | Also, both cabal (the Haskell package manager) and npm (the node.js > | package manager) behave this way. > | > | To explicitly get the old behavior, specify the sources as > | `--pkgs pkg-srcs ...`. This is useful in scripts, when `pkg-srcs` > | might be empty. > : > M Makefile | 2 +- > M pkgs/racket-pkgs/racket-doc/pkg/scribblings/pkg.scrbl | 6 ++++++ > M racket/collects/pkg/main.rkt | 15 > +++++++++++++-- > M racket/collects/racket/HISTORY.txt | 3 ++- > M .../racket-doc/pkg/scribblings/getting-started.scrbl | 5 ++--- > > =====[ Overall Diff ]=================================================== > > Makefile > ~~~~~~~~ > --- OLD/Makefile > +++ NEW/Makefile > @@ -199,7 +199,7 @@ RACKET = racket/bin/racket $(USER_CONFIG) > RACO = racket/bin/racket $(USER_CONFIG) -N raco -l- raco > WIN32_RACKET = racket\racket $(USER_CONFIG) > WIN32_RACO = racket\racket $(USER_CONFIG) -N raco -l- raco > -X_AUTO_OPTIONS = --skip-installed --deps search-auto $(JOB_OPTIONS) > +X_AUTO_OPTIONS = --skip-installed --deps search-auto --pkgs $(JOB_OPTIONS) > USER_AUTO_OPTIONS = --scope user $(X_AUTO_OPTIONS) > LOCAL_USER_AUTO = --catalog build/local/catalog $(USER_AUTO_OPTIONS) > SOURCE_USER_AUTO_q = --catalog "$(SRC_CATALOG)" $(USER_AUTO_OPTIONS) > > pkgs/racket-pkgs/racket-doc/pkg/scribblings/getting-started.scrbl > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > --- OLD/pkgs/racket-pkgs/racket-doc/pkg/scribblings/getting-started.scrbl > +++ NEW/pkgs/racket-pkgs/racket-doc/pkg/scribblings/getting-started.scrbl > @@ -300,10 +300,9 @@ get started. > Whether creating a @tech{single-collection package} or a > @tech{multi-collection package}, the next step is to link your > development directory as a locally installed package. Use > -@command-ref{install} in the directory where you created the > -@nonterm{pkg-name} directory: > +@command-ref{install} in the @nonterm{pkg-name} directory: > > -@commandline{raco pkg install --link @nonterm{pkg-name}} > +@commandline{raco pkg install} > > If you use @command-ref{show} at this point, you'll see a line for > @nonterm{pkg-name}. The ``Source'' column will show that it's a > > pkgs/racket-pkgs/racket-doc/pkg/scribblings/pkg.scrbl > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > --- OLD/pkgs/racket-pkgs/racket-doc/pkg/scribblings/pkg.scrbl > +++ NEW/pkgs/racket-pkgs/racket-doc/pkg/scribblings/pkg.scrbl > @@ -322,6 +322,9 @@ sub-commands. > If a given @nonterm{pkg-source} is ``auto-installed'' (to satisfy > some other package's > dependency), then it is promoted to explicitly installed. > > + If no @nonterm{pkg-source}s are supplied, the current directory is > + installed as a link. See the @DFlag{link} flag below for more > details. > + > The @exec{install} sub-command accepts > the following @nonterm{option}s: > > @@ -377,6 +380,9 @@ sub-commands. > of the given directory will not change for each given directory > that implements a > @tech{multi-collection package}.} > > + @item{@DFlag{pkgs} --- Disables default installation of the current > directory when no @nonterm{pkg-source}s > + are supplied.} > + > @item{@DFlag{copy} --- Disables default handling of directory > @tech{package sources} as links, > and instead treats them like other sources: package content is > copied to install.} > > > racket/collects/pkg/main.rkt > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > --- OLD/racket/collects/pkg/main.rkt > +++ NEW/racket/collects/pkg/main.rkt > @@ -151,6 +151,7 @@ > #:once-each > catalog-flags ... > [#:bool skip-installed () ("Skip a <pkg-source> if already > installed")] > + [#:bool pkgs () ("Install only the specified packages, even > when none are provided")] > install-force-flags ... > job-flags ... > #:args pkg-source > @@ -159,8 +160,18 @@ > 'install > scope scope-dir installation user #f a-type > (lambda () > + (when (and name (> (length pkg-source) 1)) > + ((current-pkg-error) (format "the --name flag only > makes sense with a single package source"))) > (unless (or (not name) (package-source->name name)) > ((current-pkg-error) (format "~e is an invalid package > name" name))) > + ;; if no sources were supplied, and `--pkgs` was not > + ;; explicitly specified, install the current directory > + ;; as a linked directory > + (define-values (sources a-type*) > + (if (and (not pkgs) (null? pkg-source)) > + (values (list (path->string (current-directory))) > + 'link) > + (values pkg-source a-type))) > (define setup-collects > (with-pkg-lock > (parameterize ([current-pkg-catalogs (and catalog > @@ -173,8 +184,8 @@ > #:update-deps? update-deps > #:strip (or (and source 'source) (and > binary 'binary)) > #:link-dirs? link-dirs? > - (for/list ([p (in-list pkg-source)]) > - (pkg-desc p a-type name checksum > #f)))))) > + (for/list ([p (in-list sources)]) > + (pkg-desc p a-type* name checksum > #f)))))) > (setup no-setup setup-collects jobs)))] > ;; ---------------------------------------- > [update > > racket/collects/racket/HISTORY.txt > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > --- OLD/racket/collects/racket/HISTORY.txt > +++ NEW/racket/collects/racket/HISTORY.txt > @@ -1,8 +1,9 @@ > Version 5.90.0.9 > -Allow hash table chaperones and impersonators to Support efficient > +Allow hash table chaperones and impersonators to support efficient > hash-clear and hash-clear! > setup/collection-name: added > syntax/unsafe/for-transform: added > +raco pkg install with no arguments installs the current directory. > > Version 5.90.0.6 > Added path<?, symbol<? >
_________________________ Racket Developers list: http://lists.racket-lang.org/dev