Emacs: How does one run RSpec? - emacs

How does one run rspec-mode in emacs? What I have tried is:
Go to spec file in Emacs
Run M-x rspec-verify-all
I get the following output in *rspec-compilation* buffer
-*- mode: rspec-compilation; default-directory: "~/mydir" -*-
RSpec Compilation started at Sun Feb 15 21:31:36
bundle exec rake spec SPEC_OPTS='--options /Users/rabraham/mydir/.rspec' SPEC='/Users/rabraham/mydir/spec'
RSpec Compilation finished at Sun Feb 15 21:31:39
No tests are run. I have a failing test but that is not caught. Is there a tutorial on running rspec-mode in Emacs?

There is no rake "spec" task by default. You should configure your Rakefile like described here

Related

Runing mix new app_first failed on CentOS

I also encounter the problem: Runing mix new app_first failed in Elixir.
It runs on centos. This is the message:
The erlang version is normal :
github#localhost:$ erl
Erlang/OTP 24 [erts-12.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1]
The elixir version is normal
github#localhost:~/elixir-otp-24$ bin/elixir --version
Erlang/OTP 24 [erts-12.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1]
Elixir 1.14.0 (compiled with Erlang/OTP 24)
But the mix is abnormal
github#localhost:~/elixir-otp-24$ bin/mix
{"init terminating in do_boot",{badarg,[{erlang,apply,[{'Elixir.Kernel.CLI.Config',[],<<".">>,[],true,[],[],false},update_commands,[#Fun<Elixir.Kernel.CLI.18.41400255>]],[{error_info,#{module=>erl_erts_errors}}]},{'Elixir.Kernel.CLI',process_argv,2,[{file,"lib/kernel/cli.ex"},{line,191}]},{'Elixir.Kernel.CLI',main,1,[{file,"lib/kernel/cli.ex"},{line,14}]},{init,start_em,1,[]},{init,do_boot,3,[]}]}}
init terminating in do_boot ({badarg,[{erlang,apply,[{_},update_commands,[_]],[{_}]},{Elixir.Kernel.CLI,process_argv,2,[{_},{_}]},{Elixir.Kernel.CLI,main,1,[{_},{_}]},{init,start_em,1,[]},{init,do_boot,3,[]}]})
Crash dump is being written to: erl_crash.dump...done
I have tried many ways, such as building from source. But it always failed.
I find the anwer: it should be setting environment variables.
PATH=/data/github/elixir-otp-24/bin:$PATH
Put it in .bashrc
Source .bashrc
It works
github#localhost:~$ mix
** (Mix) "mix" with no arguments must be executed in a directory with a mix.exs file
Usage: mix [task]

Centos7 SystemD - Systemctl startup issue

I have my bash script which I set my service to run ExecStart on - now my bash script with run directly via the user 'staytus' starts and stops things as expected but for some reason that I do not under stand yet when I run it via systemctl it throws errors!
Now since it works fine running as the same user I have the service set to use that kinda tells me the problem is with the startup file.
[Unit]
Description=Starts up procodile which runs staytus
[Service]
User=staytus
Type=simple
ExecStart=/usr/bin/startup/start.sh
Restart=on-abort
[Install]
WantedBy=multi-user.target
I've tried adding a working directory, changing the user etc all with no luck - any other suggestions of what to try?
Oct 12 15:36:52 system-name start.sh: /usr/local/bin/procodile: line 10: require: command not found
Oct 12 15:36:52 system-name start.sh: /usr/local/bin/procodile: line 12: version: command not found
Oct 12 15:36:52 system-name start.sh: /usr/local/bin/procodile: line 16: syntax error near unexpected token `('
Oct 12 15:36:52 system-name start.sh: /usr/local/bin/procodile: line 16: ` str = str.dup.force_encoding("BINARY") if str.respond_to? :force_encoding'
Oct 12 15:36:52 system-name systemd: status.service: main process exited, code=exited, status=2/INVALIDARGUMENT
On Systemd the environment variables for a process run by ExecStart is not the same as on the user terminal.
See https://www.freedesktop.org/software/systemd/man/systemd.exec.html#Environment%20variables%20in%20spawned%20processes
You'd have to check the environment variables where it runs ok (maybe using set command on the terminal) and add the needed ones on the systemd service definition using Environment="VAR1=VALUE1" "VAR2=VALUE2". See https://www.freedesktop.org/software/systemd/man/systemd.exec.html#Environment

IPython MPI with a Machinefile

I want to use IPython's MPI abilities with distributed computing. Namely I would like MPI to be run with a machine file of sorts so I can add multiple machines.
EDIT:
I forgot to include my configuration.
Configuration
~/.ipython/profile_default/ipcluster_config.py
# The command line arguments to pass to mpiexec.
c.MPILauncher.mpi_args = ["-machinefile ~/.ipython/profile_default/machinefile"]
# The mpiexec command to use in starting the process.
c.MPILauncher.mpi_cmd = ['mpiexec']
Bash Execution
$ dacluster start -n20
2015-06-10 16:16:46.661 [IPClusterStart] Starting ipcluster with [daemon=False]
2015-06-10 16:16:46.661 [IPClusterStart] Creating pid file: /home/aidan/.ipython/profile_default/pid/ipcluster.pid
2015-06-10 16:16:46.662 [IPClusterStart] Starting Controller with MPI
2015-06-10 16:16:46.700 [IPClusterStart] ERROR | IPython cluster: stopping
2015-06-10 16:16:47.667 [IPClusterStart] Starting 20 Engines with MPIEngineSetLauncher
2015-06-10 16:16:49.701 [IPClusterStart] Removing pid file: /home/aidan/.ipython/profile_default/pid/ipcluster.pid
Machinefile
~/.ipython/profile_default/machinefile
localhost slots=8
aidan-slave slots=16
I might mention that it works when I run
mpiexec -machinefile machinefile mpi_hello
And the output of that execution includes hostnames, so I am sure it is actually distributing. Plus I watch on top.
Thank you,
I guess I asked too soon. the problem was in the below line
c.MPILauncher.mpi_args = ["-machinefile ~/.ipython/profile_default/machinefile"]
It should have been split on the spaces with absolute path
c.MPILauncher.mpi_args = ["-machinefile", "/home/aidan/.ipython/profile_default/machinefile"]
I hope this can help someone. Note that this solves only the problem in the BASH output. The connection is made with MPI to a remote server (namely aidan-slave). If start the dacluster, then I see in top a bunch of python sessions start, symptomatic of a IPython session running remotely.
Unfortunately, DistArray examples, at least pi_montecarlo, hang indefinitely. I worked back to the source of the issue and found that the line that is hanging in line 736 in the context.py file of the globalapi module in distarray.
def _execute(self, lines, targets):
return self.view.execute(lines, targets=targets, block=True)
I think this is a symptom of a broken or bad MPI connection because the line seems to want to execute a command on all the slaves processes. I don't know how to fix it.

Can't install scala in emacs - An error occurred while loading `/home/nazar_art/.emacs'

I tried to install Scala accord this Set up for learning Scala with Emacs.
My current OS is Ubuntu 12.04.
I did exactly step by step.
After installation I run Emacs and see next error:
Warning (initialization): An error occurred while loading `/home/nazar_art/.emacs':
File error: Cannot open load file, scala-mode-auto
To ensure normal operation, you should investigate and remove the
cause of the error in your initialization file. Start Emacs with
the `--debug-init' option to view a complete error backtrace.
I guessed that it is problem with permission. I change it for scala-mode but without success.
Here is content of ~/.emacs.d:
nazar_art#nazar-desktop:~/.emacs.d$ ls -lg
total 12
drwx------ 2 nazar_art 4096 Oct 10 10:58 auto-save-list
drwxrwxr-x 4 nazar_art 4096 Oct 5 00:12 elpa
drwxrwxrwx 4 nazar_art 4096 Oct 10 10:41 scala-mode
I'm newly at emacs and not sure that can find cause of error follow my intuition.
Any suggestion?
How to solve this trouble?
This worked for me:
Install Scala
sudo apt-get install scala
Get scala-mode
cd ~/git
git clone git://github.com/tuxdna/scala-mode.git
Set up the load-path
(add-to-list 'load-path "~/git/scala-mode")
Require scala-mode-auto
(require 'scala-mode-auto)
Created my first Scala source ~/first.scala. The mode was loaded.
object First {
def main(args: Array[String]) {
println("Test")
}
}
M-x scala-run-scala
Loaded the source with C-c C-l.
Entered First.main(null) in the interpreter. The program ran.

Hudson failing build w/o revealing cause

Every build has failed as of Tuesday. I'm not exactly sure what happened. The Phing targets (clean/prepare) are being executed properly. Additionally, the unit tests are passing with flying colors, with only a warning for duplicate code (not a reason for a fail). I tried removing the phpDoc target to see if that was causing the error, but the build still failed.
Started by user chris Updating
file://localhost/projects/svn/ips-com/trunk
At revision 234 no change for
file://localhost/projects/svn/ips-com/trunk
since the previous build [trunk] $
/opt/phing/bin/phing clean prepare
-logger phing.listener.NoBannerLogger Buildfile:
/var/lib/hudson/.hudson/jobs/IPS/workspace/trunk/build.xml
IPS > clean:
[echo] Clean... [delete] Deleting directory
/var/lib/hudson/.hudson/jobs/IPS/workspace/build
IPS > prepare:
[echo] Prepare...
[mkdir] Created dir: /var/lib/hudson/.hudson/jobs/IPS/workspace/build
[mkdir] Created dir: /var/lib/hudson/.hudson/jobs/IPS/workspace/build/logs
[mkdir] Created dir: /var/lib/hudson/.hudson/jobs/IPS/workspace/build/logs/coverage
[mkdir] Created dir: /var/lib/hudson/.hudson/jobs/IPS/workspace/build/logs/coverage-html
[mkdir] Created dir: /var/lib/hudson/.hudson/jobs/IPS/workspace/build/docs
[mkdir] Created dir: /var/lib/hudson/.hudson/jobs/IPS/workspace/build/app
BUILD FINISHED
Total time: 1.0244 second
[workspace] $ /bin/bash -xe
/tmp/hudson3259012225710915845.sh
+ cd trunk/tests
+ /usr/local/bin/phpunit --verbose -d memory_limit=512M --log-junit
../../build/logs/phpunit.xml
--coverage-clover ../../build/logs/coverage/clover.xml
--coverage-html ../../build/logs/coverage-html/
PHPUnit 3.5.0 by Sebastian Bergmann.
IPS Default_IndexControllerTest .
Default_AuthControllerTest ......
Manage_UsersControllerTest .....
testDeleteInvalidUserId ..
testGetPermissionsForInvalidUserId .. Audit_OverviewControllerTest
............
Time: 14 seconds, Memory: 61.00Mb
[30;42m[2KOK (28 tests, 198
assertions) [0m[2K Writing code
coverage data to XML file, this may
take a moment.
Generating code coverage report, this
may take a moment.
Warning: Unknown: Error occured while
closing statement in Unknown on line 0
Warning: Unknown: Error occured while
closing statement in Unknown on line 0
Warning: Unknown: Error occured while
closing statement in Unknown on line 0
Warning: Unknown: Error occured while
closing statement in Unknown on line 0
Warning: Unknown: Error occured while
closing statement in Unknown on line 0
Warning: Unknown: Error occured while
closing statement in Unknown on line 0
Warning: Unknown: Error occured while
closing statement in Unknown on line 0
Warning: Unknown: Error occured while
closing statement in Unknown on line 0
[workspace] $ /bin/bash -xe
/tmp/hudson1439023061736436000.sh
+ /usr/local/bin/phpcpd --log-pmd ./build/logs/cpd.xml ./trunk phpcpd
1.3.2 by Sebastian Bergmann.
Found 1 exact clones with 6 duplicated
lines in 2 files:
library/Ips/Form/Decorator/SplitInput.php:8-14
library/Ips/Form/Decorator/FeetInches.php:10-16
0.04% duplicated lines out of 16585 total lines of code.
Time: 4 seconds, Memory: 19.50Mb [DRY]
Skipping publisher since build result
is FAILURE Publishing Javadoc [xUnit]
[INFO] - Starting to record. [xUnit]
[WARNING] - Can't create the path
/var/lib/hudson/.hudson/jobs/IPS/workspace/generatedJUnitFiles.
Maybe the directory already exists.
[xUnit] [INFO] - Processing
PHPUnit-3.4 (default) [xUnit] [INFO] -
[PHPUnit-3.4 (default)] - 1 test
report file(s) were found with the
pattern 'build/logs/phpunit.xml'
relative to
'/var/lib/hudson/.hudson/jobs/IPS/workspace'
for the testing framework 'PHPUnit-3.4
(default)'. [xUnit] [INFO] -
Converting
'/var/lib/hudson/.hudson/jobs/IPS/workspace/build/logs/phpunit.xml'
. [xUnit] [INFO] - Stopping recording.
Publishing Clover coverage report...
Publishing Clover XML report...
Publishing Clover coverage results...
Finished: FAILURE
What changed since Tuesday? Try to manually run exactly the same commands that Hudson tries to run from the same directory that Hudson starts it from (usually the jobs workspace directory). Of course with the user account that Hudson is started under.
There are several possibilities. ranging from standard groups for a directory, to permission, or other things outside of Hudson. Was Hudson upgraded? Was a plugin upgraded? Was the OS or php upgraded? Was there a change in the default or user .profile or .env (or the equivalent files)? Does another process accesses the workspace? ......
Once I had the problem that all of the sudden my deployment scripts did not run anymore. The mystery was, that I could still run the script from command line with the Hudson user account. The reason was simple but took a while to uncover. There was a java upgrade from 5 to 6. Both versions were available. After comparing the environment variables, there was a difference in the path. The problem was that the new path was set in the global .profile. But Hudson does not open an interactive shell, therefore the .profile will not be executed. If you have a problem like this, you can put the initialization in the .env file (or whatever the filename is for your system), because this will be run regardless if it is a interactive shell or not. Alternatively you can configure Hudson to set it on master or node/slave level.
if you want a command to not break the 'build' as a failure you have to add #! in front of the command to prevent the flags -xe which produce this behaviour.