'ALGOLIA_API_KEY' not recognized as an internal or external command - jekyll

I am trying to run algolia for the first time but it seems that there is something wrong with my environment. I followed the detailed explanation here https://community.algolia.com/jekyll-algolia/getting-started.html.
I installed and configured everything that is needed from the previous steps but when I run the command
ALGOLIA_API_KEY=xxxxxxxxxxxxxx bundle exec jekyll algolia
I get an error:
'ALGOLIA_API_KEY' is not recognized as an internal or external command,
operable program or batch file.
I have been rereading the documentation for both jekyll and angolia but couldn't find anything that could be helpful.

Since you're running on Windows, you cannot set an environment variable for your command like you can do on UNIX.
As advised in this question, Setting and using variable within same command line in Windows cmd.exe, I believe you could use
set ALGOLIA_API_KEY=xxxxxxxxxxxxxx && bundle exec jekyll algolia

Related

Trying to install Moralis-admin-cli

I am trying to install the "moralis-admin-cli" program to make my account and I have to add it the path that the Terminal gave me so it will download in the proper directory.
I did have a problem where the cursor was but that has been overcome.
So when I type in the code as the tutorial tells this how the tutorial shows how to do it and this is the error:
C:\metadata-static-app>npm install -g moralis-admin-cli
'npm' is not recognized as an internal command, operable program or batch file.
I just need to find a way to install this moralis program in the "metadata-static-app" directory on my computer so I can move on to the next step.
Can you help me.
Add node.js on your environment, the npm command will work!

ModuleNotFoundError when running functional python tests despite that textX command works

I followed the set of instructions for this open source.
At step 3, I am supposed to run
py.test tests/functional/
When I do so, I get
ModuleNotFoundError: No module named 'textx'
However, when I type textx, it's definitely working as a command.
Where did I go wrong?
The PYTHONPATH is not set by py.test, see https://docs.pytest.org/en/latest/pythonpath.html#pythonpath
As described in https://github.com/igordejanovic/textX/blob/master/CONTRIBUTING.md you install textX in your virtual environment. If you omit 'pip install -e .' you get the described behavior.
As mentioned above, you can set the PYTHONPATH manually. Alternatively you can also run 'python -m pytest tests/functional' as proposed on the py.test website.
It is unclear to me why the textx command works in your example. Maybe you installed textX outside your virtual environment after creating the virtual environment?
Run export PYTHONPATH=. before running the py.test tests/functional/ and it should work.
This error may have occurred because I installed textX outside my virtual environment after creating the virtual environment.

Hart'ls Ruby Tutorial - Subl Gemfile not recognized

I'm brand new to Ruby and Rails, so sorry if this is a totally ridiculous question. The tutorial book that I'm reading says that I should be able to launch a Gemfile in Sublime Text directly from the command prompt using the subl Gemfile command. When I try this, I get an error that says "subl is not recognized as an internal or external command, operable program, or batch file".
I am in the right directory where the Gemfile is located.
Ruby is definitely installed and I am using the command prompt with Ruby and Rails.
i have the sublime text 2 and i added the path as i found,but no solution.i even tried :sublime_text Gemfile
i have tried so many different solutions but no result.
i'm using windows
Thank you in advance
the reason it isn't working isn't a rails question, it is because you haven't set up sublime to work using the command "subl" in your terminal. Try these commands. If you wish to understand the error better, just type in any gibberish into the terminal. It will tell you a similar thing.
sudomkdir /usr/local
sudomkdir /usr/local/bin
sudo ln-s/Applications/Sublime\Text\2.app/Contents/SharedSupport/bin/subl /usr/local/bin/subl
EDIT
Sublime Text from Command Line (Win7)
https://teamtreehouse.com/forum/sublime-text-command-line-shortcut-windows
https://teamtreehouse.com/forum/ruby-on-rails-subl-command-not-found
Otherwise, you can refer to this
subl is Mac only.
For Windows, you need to add C:\Program Files (x86)\Sublime Text 2 to your Environment path,
This will work on Windows 7:
Right click My Computer, Properties, then Advanced System Settings, then Environment Variables.. Go down to System Variables, and edit PATH, you'll need to add the Path to Sublime.
Then you should be able to run sublime_text my-file from the command line. (Since the .exe is called sublime_text.exe

How to add path variable to job shell

I am setting up Jenkins to replace our current TeamCity CI build.
I have created a free-style software project so that I can execute a shell script.
The Shell script runs the mvn command.
But the build fails complaining that the 'mvn' command cannot be found.
I have figured that this is because Jenkins is running the build in a different shell, which does not have Maven on it's path.
My question is; how do I add the path so 'mvn' is found in my Shell script? I've looked around but can't spot where the right place might be.
Thanks for your time.
I solved this by exporting and setting the Path in the Jenkins Job configuration where you can enter shell commands. So I set the environments variable before I execute my Shell script, works a treat.
Some possible solutions:
You can call maven with an absolute path
You configure a global environment variable in the jenkins system settings with the absolute path to your maven instance, and use this in your script call (if you use the inline shell script, I don't know if those are substituted to a called script, you have to test)
You use a maven project and configure your maven instance in the jenkins system settings
ps.: Usually /bin/sh is chosen from Jenkins, if you want to switch to eg. bash, you can configure this in the jenkins system settings, in case you want to configure global environment variables.
You can use envInject plugin. It's very powerful.
I use it to install rbenv. And it can inject environment variables into your current job.
Another option to Dags suggestion is that if you're only using a single version of maven, on each slave server you could do either;
* add PATH=${PATH}:
* symlink mvn into /usr/bin with; sudo ln -s /usr/bin
I'm not at a Jenkins box at the moment, but I can find some more detailed examples if you'd like.
Jenkins is using sh by default and not bash.
This is my first time defining a jenkins maven job, and I also followed soem regular maven instructions (for running from command line...), and tried to update ~/.bashrc with M2_HOME, M2, PATH, but it didn't work because jenkins used sh and not bash. Then I found out that there is a simpler and better way built into jenkins.
After installing maven, I was supposed to configure my maven installation in jenkins.
To configure your maven installation in Jenkins:
login to jenkins web console
click Manage Jenkins --> Configure System
Under Maven, click the "Maven Installations..." button
a. Give it some name
b. and under MVN_HOME set the path to where you installed maven, for example "/usr/local/apache-maven/apache-maven-3.0.5"
Click Save button
Define a job with maven target
edit your job
Click "Add build step"
on Maven Version, enter the name you gave your maven installation (step #4 above)
set some goal like clean install

NSIS - jruby fails to access environment variables

I've made a NSIS script to create an installer for a Rails application.
The application uses JRuby and Java.
In the first section of the installer I set the environment variables: I add jruby\bin to PATH and I create JAVA_HOME variable, which points to Java\jre6.
!define JRubyBinPath "$PROGRAMFILES\${PRODUCT_PUBLISHER}\JRuby\jruby-1.6.3\bin"
Function SetEnvVars
# set JAVA_HOME
${EnvVarUpdate} $0 "JAVA_HOME" "A" "HKCU" "C:\Program Files\Java\jre6"
# add jruby to Path
${EnvVarUpdate} $0 "Path" "A" "HKLM" "${JRubyBinPath}"
FunctionEnd
Section "Pre" SEC01
Call SetEnvVars
...
SectionEnd
** All the paths are correct. **
In the second section of the installer, after packing all the application files and JRuby files, I initialize the database using the following commands:
Section "Installer" SEC02
...
SetOutPath $INSTDIR
nsExec::ExecToLog "jruby -S bundle exec rake db:create RAILS_ENV=production"
nsExec::ExecToLog "jruby -S bundle exec rake db:migrate RAILS_ENV=production"
nsExec::ExecToLog "jruby -S bundle exec rake db:seed RAILS_ENV=production"
...
SectionEnd
The problem is that when I run the installer on a clean Windows system, all the code executes correctly, except for the lines that contain commands using "jruby". I get no error in the installer window, it just won't execute those lines.
Anyway, if I manually run those commands in a console right after the installer finishes, everything works as expected.
From what I have seen so far, the problem is that the installer cannot access the environment variables until it finishes.
* What I have done so far to solve this problem is creating the main installer Installer.exe (here I pack all the files and I set the environment variables), and another executable Init.exe which initializes the database.
If I manually run these executables - first Installer.exe then Init.exe - the application installs correctly. But if I try to launch Init.exe from Installer.exe, it won't work.
However, if there would be a way to execute the "jruby" commands in a new/different thread than the one that sets the environment variables, I think the problem would be solved. But I still couldn't find the way to do that.
Thanks.
NSIS doesn't have any threading. Apparently not quite true—but in your own code, you don't get to use threads.
You may need to set PATH for the current process; I'm not familiar with ${EnvVarUpdate}, but looking at its script it doesn't seem to updates the variable in the current process. Try this:
${EnvVarUpdate} $0 PATH A HKLM "${JRubyBinPath}" # The line you already have
System::Call Kernel32::SetEnvironmentVariable(t"PATH",tr0)
Another note: you are hard-coding JRubyBinPath; are you sure you really want to do that?