Lein tasks and sudo - clojure

I'd like to get this running (https://github.com/maitria/avi), which recommends using
sudo lein install
But lein doesn't act like an ordinary command -- I get
sudo: lein: command not found.
There only seem to be three subcommands that run into permissions problems and I considered doing them manually, but they're fairly gnarly string-interpolated arguments to the C compiler and my chances of not making a mistake seem pretty small.

So leiningen is not your typical command. Its a tool built in Clojure and is used to manage clojure applications much like rake works for Ruby. These 3 steps should help you
Download the lien script from the leiningen home page and place it in a location that is part of your PATH.
2.Run lein in the command-line and it will install it dependencies, though you will need to make sure you preinstalled JDK
3.Run lein install in the location of your code

Related

problems installing clojure lein under mac os 10.13.6

I am using Homebrew with the command brew install leiningen but trying lein repl gives
java.lang.ClassCastException: java.lang.Character cannot be cast to java.uti
l.Map$Entr
followed by many pages ending with
clojure.main.main (main.java:37)
the same happens with Macports or supplied script, boot installs perfectly with Homebrew.
I am learning Clojure from the Brave and True book which needs lein repl
To "install" lein just download the download script from the web page and run it :
https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein
Hope it helps
Consider using sdkman, even if leiningen is straightforward to use:
curl -s "https://get.sdkman.io" | bash
Then open a new terminal and type:
sdk install leiningen
Now try your:
lein repl
While you're at it, sdk can be used to manage your Java installations. Never again worry about dirtying your system with various versions, as they all go in your home directory, cleanly.

how to use apt-buildpack from cloudfoundry repo

The apt-buildpack is experimental and not yet intended for production use. I guess that's why also no documentation.
Creating container
Successfully created container
Downloading app package...
Downloaded app package (862.7K)
Warning: this buildpack can only be run as a supply buildpack, it can not be run alone
Failed to compile droplet: Failed to compile droplet: exit status 1
Destroying container
Exit status 223
Stopping instance abdfc8d0-699e-4834-9f2d-2b8aec218423
Successfully destroyed container
Can you give me example how to push cf-env sample app and install for example rtorrent and/or openvpn. Is it possible to install gnome for testing purposes?
As far as usage goes it's pretty simple, you just need to include an apt.yml in the root directory of your app. That should contain among other things, the list of packages to install.
Ex:
---
packages:
- ascii
- libxml
- https://example.com/exciting.deb
The buildpack supports installing package names, deb files, custom APT repositories, and even PPAs.
Please see the README for further instructions.
This message:
Warning: this buildpack can only be run as a supply buildpack, it can not be run alone
Is telling you that the Apt buildpack only functions to supply binaries. It doesn't actually know how to run your app or any application. For more on the supply script, check out the docs here.
The trick to making it work is that you need to use multi buildpack support. Instructions for doing that can be found here. This should work with most apps, but there's a simple example here.
Once your app stages & starts, you can confirm that your packages were installed by running cf ssh apt-test -t -c "/tmp/lifecycle/launcher /home/vcap/app bash ''". Anything that was installed should be on the path, but if you want to see where things are installed it'll be under the /home/vcap/deps/<buildpack-number>/.
That should be about it. Hope that helps!

Leiningen 'lein install' without writing pom.xml?

I've been contributing to a project in which there's a fixed pom.xml, but I tend to modify project.clj, temporarily, for various purposes. Most of the time, Leiningen seems to ignore pom.xml, but lein install and lein deploy rewrite pom.xml. Is this necessary to Leiningen's functioning? If not, can I stop it? Haven't found anything about this in the online docs yet.
It's not a big problem, but I'd rather not deal with having to restore the official pom.xml in my project before doing a 'git commit', for example.
EDIT: I discovered a solution for my situation, which is to create a 'checkouts' directory with a link to the other project. This causes the other project to be pulled in, without creating a new jar. However, I'm still curious: Does Leiningen need to create pom.xml e.g. for lein install? Why? I'd like to understand the process.
I'm unsure of whether lein install can be run without generating a pom.xml.
The reason it generates a pom is that leiningen uses maven to grab all the dependencies. In fact, maven is able to get dependencies from clojars and leiningen uses it for the clojure dependencies as well as the java ones. Maven requires a pom.xml to specify repository locations and other configuration necessary to run javac (or any other build commands) in addition to a groupId and artifactId to deploy your library to a (potentially local) repository
Another possible workaround to your issue is to use changelists (specifically, if using tortoiseSVN, I'd use the ignore-on-commit changelist) to ignore your pom.xml in most situations commitwise. I believe this stackoverflow answer may assist you with how to do that in git.

How does one start programming with Clojure in Windows?

I know it is possible to use CounterClockwise inside Eclipse, but I have been trying to get Leiningen to work so that I could use ClojureScript.
I downloaded leiningen using git clone. It then says run the script. I have tried lein self-install from inside PowerShell and inside the git bash environment.
In each I get an error about failing to download leiningen (which I thought I had with the git clone? hmm). It is interesting because one reads instructions that include things that don't make sense to Windows.
For example, inside Powershell, Windows doesn't understand export HTTP_CLIENT. It was only inside the git bash that I got a message that it is possible my HTTP client's certificate store does not have the correct certificate authority.
It then suggests this command, which runs ok, export HTTP_CLIENT="curl --insecure -f -L -o"
but it doesn't fix the problem.
The most recommended method AFAIK is to download the script lein.bat and putting it on the PATH environment variable. I've tested this method on several systems (XP, Windows 7). There is no need to build leiningen from a git checkout yourself. If you have a Windows with Powershell installed lein self-install should download the core .jar file inside a directory .lein in your user directory. Else, make sure you install either wget.exe or curl.exe and put it on the PATH.
There is an installer for Leiningen on Windows. You just need to install Java SE 7 JDK and Leiningen for Windows. This page has detailed instructions with screen shots: http://leiningen-win-installer.djpowell.net/
Leiningen for Windows creates a PATH variable and Clojure REPL shortcut among other things. From the REPL you can create, build, and automate your Clojure project.

Deploying Django with virtualenv inside a distribution package?

I have to deploy a Django application onto a SuSE Linux Enterprise 11 system. Corporate rules say I need to deploy using RPMs only. While I can use ./setup.py bdist_rpm for each dependency, it's not really sane, since RPM doesn't record all of the dependencies yet. Therefore I'd have no real advantage in using RPMs and managing dependencies manually is somewhat cumbersome and I would like to avoid it.
Now I had the following idea: While building a package, I could create a virtualenv, install all my dependencies via pip there and then package it up with the rest of the code into one solid RPM.
How sensible is this approach?
I've been using this approach for about a year now and it has worked out pretty well.
One gotcha is that you'll want to check out the bang lines in any python scripts written to the virtualenv's bin directory. These will end up being full path names used in your build environment, which probably won't be the same directory where you end up installing the virtualenv. So you may need to add some sed calls in your RPM's postinstall to adjust the paths.