I have a directory with files like this
.
├── example.rb
└── example_spec.rb
And my init.el :
(require 'rspec-mode)
(setq-default rspec-use-rvm t)
(require 'rvm)
(rvm-use-default)
When I try to run any of the verify functions inside the example_spec.rb will result the error :
rspec-project-root: Could not determine the project root.
How do I make rspec-mode able to determine the project root and run rspec ?
Looking at docstring of rspec-project-root it seems it looks for Rakefile in the presenst directory or a parent directory. Here is the docstring
Finds the root directory of the project by walking the directory tree until it
finds a rake file.
The code suggests that a gem file will also do.
Related
I am new to the sbt and mill, and I am practicing to use both tool to build the chisel (scala project). View this github repo as a reference, I am wondering to know how to write the mill-version build.sh in that repo.
Here is my directory structure
─ chisel-template (root directory / projects directory)
├── build.sc
├── build.sh
├── src
| └─main
| └─scala
| └─lab1
| └─Mux2.scala
└── _temphelper.scala
What the build.sh do is preparing a boilerplate as main function in the root directory to make compile and run process much easier, and it's sbt version. I'm curious that why sbt can detect the main function (_temphelper.Elaborate) even it's not in the src/main directory. And when I change to use Mill, Mill can't detect the _temphelper.scala at all, unless I move the file to root/src/main. Is there settings that can make Mill do what sbt can do?
I'm not sure whether this issue is related to...
altering the sourceDirectories in sbt and chiselMoudule.sources in Mill. Any advice is welcome.
modify the millSourcePath to realize my request.
My quetions is What setting should I do to make mill can detect the main class that be in the root directory?
This is because sbt is including any Scala files it finds in the project root directory as sources files, unless told otherwise.
In contrast, Mill will only use the source files found under whatever directories are specified with sources. As a consequence, you may want to add the project root directory as source directory, but I strongly advice to do not so.
Best is to move the _temphelper.scala file either to one of the source directories or create a new dedicated directory, move the file there and add this directory to the sources like this:
object chiselModule extends CrossSbtModule // ...
{
def sources = T.sources {
super.sources() ++ Seq(PathRef(T.workspace / "your" / "new" / "directory"))
}
}
I'm new to Common Lisp, I'm using Emacs/SLIME on Windows 10, and I'm trying to wrap my head around how CL and ASDF/packaging works.
I have a custom package 'my-pack' in a directory 'D:\Dropbox\my-packages'.
I have created a .conf file in:
%LOCALAPPDATA%\config\common-lisp\source-registry.conf.d\
And added this line:
(:tree "D:\\Dropbox\\my-packages\\")
I opened Emacs, started SLIME and made the project via the REPL:
(cl-project:make-project #p"D:/Dropbox/my-packages/my-pack)
I verified that the project is in the directory and then loaded the system with asdf (version 3.3.1):
(asdf:load-system :my-pack)
And it worked fine.
But when I quit and restart Emacs, I get the following error when trying to the load the system:
Component :MY-PACK not found
[Condition of type ASDF/FIND-COMPONENT:MISSING-COMPONENT]
As far as I can tell I've followed the steps in the manual. Any help appreciated.
cl-project's make-project ends with this line:
(push dir asdf:*central-registry*)
it adds your new project's directory to this list that tells ASDF where to look for projects. What is its value when you restart CL?
2.
\config\common-lisp\
Shouldn't it be .config?
However, I don't encourage to use this conf file with :tree. The doc says:
tell ASDF to recursively scan all the subdirectories
So, imagine that just once, you try yourself at web development and you install, for example, JavaScript dependencies with npm or equivalent, you'll end up with a gigantic node_modules/ and your Lisp will now take a few seconds to start up.
I suggest to put your projects under ~/common-lisp/ or ~/quicklisp/local-projects, or to create symlinks, or to add yourself your projects in asdf:*central-registry* from your Lisp startup file:
;; .sbclrc
(pushnew "/home/me/projects/ciel/" asdf:*central-registry* :test #'equal)
I'm making a web application. Consider such structure
ProjectName/racket/Servlet.rkt
ProjectName/racket/chart/barchart/BarChart.rkt
ProjectName/template/barchart.svg
How can I inside the BarChart.rkt module require the Barchart.svg template, without using any ..? Ideally, if the application is launched from ProjectName (i.e. cd ProjectName; racket racket/Servlet.rkt), the require part would resemble (require "template/barchart.svg"), but use ProjectName as a root instead of the relative ProjectName/racket/barchart.
1) Naive method
You can use (define-runtime-path):
ProjectName/chart/barchart/BarChart.rkt:
#lang racket/base
(provide barchart-template)
(require
racket/runtime-path
racket/file)
(define-runtime-path barchart.svg "../../template/barchart.svg")
(define (barchart-template)
(file->string barchart.svg))
ProjectName/Servlet.rkt:
#lang racket/base
(require ProjectName/chart/barchart/Barchart)
(displayln (barchart-template)) ;; prints the content of the SVG file, wherever you are
2) Better method
Registering your package
From my experience, the best way to handle paths when developing a Racket application is making a package, then use the classic (require my-package/my-module) syntax instead of using relative paths.
For example, if you have a project like this:
ProjectName/Servlet.rkt
ProjectName/chart/barchart/BarChart.rkt
ProjectName/template/barchart.svg
By adding an info.rkt file at the root of your project, you transform it into a package.
echo "#lang info" > ProjectName/info.rkt
Then call cd ProjectName; raco pkg install.
Then you can require BarChart.rkt in any file with (require ProjectName/chart/BarChart).
Why am I telling you all this? Because now, you can start your application from any folder:
racket -l ProjectName/Servlet
Which will allow you to test easily if your paths are handled whatever the directory you are running the program in.
Getting rid of ../..
Now that your package is registered in your local database, you can easily find it's root directory using (pkg-directory) from pkg/lib:
ProjectName/chart/barchart/BarChart.rkt:
#lang racket/base
(provide barchart-template)
(require
racket/file
pkg/lib)
(define (barchart-template)
(define template.svg (build-path (pkg-directory "ProjectName")
"template/barchart.svg"))
(file->string template.svg))
I have installed some packages by using elpa in my Emacs, but how are they loaded when launching Emacs?
package-install is a part of package.el -- which You can see with describe-function. From package.el documentation:
;; At activation time we will set up the load-path and the info path,
;; and we will load the package's autoloads. If a package's
;; dependencies are not available, we will not activate that package.
So in every package there's a file
NAME-autoloads.el
and this file is loaded at start up.
The whole package is contained under the package-user-dir:
(setq package-user-dir "~/.emacs.d/site-lisp/package-install")
(require 'package)
Each package also contains NAME-pkg.el with package version and description. For example here're files related to tabbar package:
package-install # that's my package-user-dir
└── tabbar-2.0.1 # each package dir is in the separate dir
├── tabbar-autoloads.el # this file is loaded at start up
├── tabbar.el # the package itself. In this case it is just a single file
└── tabbar-pkg.el # information about the package for package managment
To quote the manual: 39.1.1 Summary: Sequence of Actions at Startup:
15. If package-enable-at-startup is non-nil, it calls the function package-initialize to activate any optional Emacs Lisp package that has been installed.
package-initialize is then calls package-activate which in turn calls package-activate-1 which ends with loading NAME-autoload.el:
(load (expand-file-name (concat name "-autoloads") pkg-dir) nil t)
I would like to be able to use find-function and find-variable for definitions found within the src directory and am wondering whether it is possible to have this packaged into the application when building, rather than coping this over manually after the Emacs build has already occurred. I'm building on OSX with the following command-line entries:
/macports/bin/bzr branch --stacked bzr://bzr.savannah.gnu.org/emacs/trunk emacs-trunk
;; cd over to the new emacs-trunk directory that was just downloaded.
/macports/bin/bzr pull
./autogen.sh
./configure --with-ns
make bootstrap
make && make install
;; the new Emacs build is waiting for you in .../emacs-trunk/nextstep
Here is how to do it manually:
M-x eshell
/macports/bin/bzr branch --stacked bzr://bzr.savannah.gnu.org/emacs/trunk emacs-trunk
;; cd over to the newly downloaded '.../emacs-trunk' main directory
/macports/bin/bzr pull
./autogen.sh
./configure --with-ns
make bootstrap
make && make install
cp -r /Users/HOME/Desktop/emacs-trunk/src /Users/HOME/Desktop/emacs-trunk/nextstep/Emacs.app/Contents/Resources/
;; create: '.../lisp/site-start.el' with the following contents:
(load-file "/Users/HOME/.0.data/.0.emacs/init.el")
;; adjust the following c-source variable as needed:
(setq find-function-C-source-directory (concat root.d "Emacs_01_19_2014.app/Contents/Resources/src"))