need help installing emacs rails reloaded - ruby-on-rails

Hi I am trying to install the emacs rails reloaded mode from https://github.com/dima-exe/emacs-rails-reloaded.
As per the directions I have cloned the repo and added the lines to my .emacs file. However it asks for byte compiling by -
Next bytecompile, press [M-x] and type rails/bytecompile.
However I cant find that function, what do I do ?

Note that you should restart Emacs between the steps
After that add bellow code in your the .emacs file:
(setq load-path (cons (expand-file-name "~/.emacs.d/rails-reloaded")
load-path))
(require 'rails-autoload)
and
Next bytecompile, press [M-x] and type rails/bytecompile.
Also, before restarting, make sure that you have changed "~/.emacs.d/rails-reloaded" to the actual path where the file rails-autoload.el lives. If you cloned the git repository, that path name should almost certainly end in emacs-rails-reloaded (and not just rails-reloaded).
If that path is incorrect, Emacs will report an error when it tries to execute (require 'rails-autoload). If it is correct, M-x rails/bytecompile should work.

Related

Configuring Packer with Neovim

I'm trying to switch over my current setup for Neovim (using Vim Plug) to Packer and I'm having trouble.
My Neovim is loaded from ~/.config/nvim/init.lua which sources all of my plugin and other settings. They live mostly inside of a ~/lua folder (the "main Imports") section of my configuration, including my actual plug-plugins.lua file that references all of my plugins.
-- Main Imports
require("settings")
require("colors")
require("mappings")
require("functions")
require("autocommands")
require("plug-plugins")
...
Later in the same init.lua file, I'm sourcing plugin specific settings for all of these plugins. In order to get my directory working currently, I'm installing everything with :PlugInstall and it works fine.
...
-- Plugin-specific settings
require("plugin-settings/fzf")
require("plugin-settings/fugitive")
require("plugin-settings/ultisnips")
require("plugin-settings/coc")
require("plugin-settings/treesitter")
require("plugin-settings/miscellaneous")
require("plugin-settings/toggle-terminal")
Installing Packer
The installation steps for Packer are pretty sparse, and merely state that you should clone the repository to somewhere in your "packpath" but I'm not really clear what that means. When I'm inside Neovim, and I press :set packpath? I get the following paths:
packpath=~/.config/nvim,/etc/xdg/nvim,~/.local/share/nvim/site,/usr/local/share/nvim/site,/usr/share/nvim/site,/usr/local/Cellar/neovim/HEAD-b74916c_1/share/nvim/runtime,/usr/local/Cel
lar/neovim/HEAD-b74916c_1/lib/nvim,/usr/share/nvim/site/after,/usr/local/share/nvim/site/after,~/.local/share/nvim/site/after,/etc/xdg/nvim/after,~/.config/nvim/after
This makes me think that I'm able to just clone the respository to ~/.config/nvim which is the first path listed. I'm not really sure what to do next though, or if this is even right.
Can anyone help? What are the basic steps to getting Packer installed (I'm on MacOS 11.6).
i did recently moved from vim-plug to packer, as per docs when you do git clone of the repo the path provided in readme for installation is ~/.local/share/nvim/site/pack/packer.After successful clone you can start using packer in your plugins.lua as below.
return require('packer').startup(function()
use 'wbthomason/packer.nvim'
end)
you can check the installation by running :PackerSync this will fetch (git clone) the plugin in to the packerpath which is ~/.local/share/nvim/site/pack/packer
Hope this is what you looking for?
I had the exact same situation and it turned out to just be a naming conflict. I had named my local nvim config file lua/packer.lua and changing that fixed the issue.

Installing a driver in NSIS script

I'm trying to create an NSIS installer that installs an inf file. The inf file is extracted from the installer to the correct place, and then I use:
nsExec::ExecToLog '"$SYSDIR\PnPutil.exe" /a "$INSTDIR\driver\xser.inf"'
However, the command does not seem to get executed at all - the install log doesn't print anything - not success nor failure. I've checked thoroughly the command line and it points to the right PnPutil path. I've also checked that it's being run with administrator privileges and it also looks correct. Replacing PnPutil.exe with a different executable in the System32 directory also seem to work without any problem. What am I missing here?
If this only happens on 64bit systems you can try to disable FS redirection around the call to nsExec::ExecToLog by using the macros in x64.nsh:
!include x64.nsh
${DisableX64FSRedirection}
nsExec::ExecToLog '"$SYSDIR\PnPutil.exe" /a "$INSTDIR\driver\xser.inf"'
${EnableX64FSRedirection}

How do I save a ruby file? (error)

I am receiving the error No such file or directory in my command line and I think it's because I am not saving the ruby files somewhere specific. All I did was create a random folder where I would save my ruby files.
Do I need to save my scripts in the original ruby folder? Thanks!
** This is Windows 7.
More info -
All I did was make a simple file named "Matz.rb" because I'm currently reading the O'reilly Ruby book. In my code all I wrote was puts "Hello Matz". I saved this on my desktop. When I go to the command line it and I write ruby matz.rb it says "ruby: No such file or directory -- matz.rb " Please help :(
If this has something to do with PATH or shells, I honestly have no idea what those really are because I just started coding last night.
You are most likely not in the right folder. You somehow need to tell the ruby interpreter where it is looking for the file.
Either make sure you're in the right folder - the cd command allows you to change location:
cd C:\Users\Username\Desktop
ruby Matz.rb
or specify the path explicitly:
ruby C:\Users\Username\Desktop\Matz.rb
By default, the ruby interpreter will look in your current directory (the location shown in your prompt) for whatever filename you give it.
Edit: I'll attempt to explain what I mean step-by-step.
When you initially open the command prompt, it will indicate what folder you are in (your "current working directory") in the prompt:
C:\Users\YourUsername >
In the above example, you are working in the C:\Users\YourUsername folder.
You can move directories using the cd command. For example, typing cd Desktop moves you into the folder called Desktop, assuming such a folder exists in your current location
You can move to another folder outside your current folder by specifying explicitly where you want to be: cd C:\Another\Place
When you run a ruby command such as ruby Matz.rb, the system knows how to find the ruby program because the installer placed its location into the PATH environment variable. Don't worry about this too much, this just explains the "magic" by which it knows what ruby means, no matter where you are.
Ruby finds the file you specify (in the above example, Matz.rb) by looking in the current directory. To re-iterate, it is looking in whatever folder is written right there in your prompt.
You can tell ruby to look outside the current folder by specifying the full path (as shown in the answer above).
To go from a new command window that you've just opened, to typing ruby Matz.rb and having it work, you need to do the following:
Move to the correct directory
Run the command
If we assume your username is alex and you have a folder on your desktop called "rubycode", which contains Matz.rb, you could do this:
Open a command prompt, which will most likely start in C:\Users\Alex
Move to the rubycode folder on your desktop: cd Desktop\rubycode. All subsequent commands will be working from within this folder.
Run the ruby command, specifying the file: ruby Matz.rb
Continue to run ruby commands as you learn ruby.
I hope that makes sense.

What is wrong with this rails template?

I am attempting to take a whack at creating my first Rails application template and I am running into a slight issue with the copy_file method.
First some background.... Apparently the Ruby OpenSSL package does not ship with a CA store, so any attempt to connect to an HTTPS service will fail out of the box. The way around this(for Rails 3 apps) is to add the line OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE to the top of your config/environment.rb file. I need to do this on the fly in my template so I can install jQuery.
So I have that all figured out, my general thought is to:
Make a backup of my config/environment.rb file.
Prepend the data to original
Run the jquery:install --ui task
Restore the original config/environment.rb file.
See my template Gist, Lines 25..34 is the relevant section.
So all of that works until step #4 which fails with Error: Could not find "env.orig" in any of your source paths on line #31.
This is VERY perplexing to me because line #28 works, I can see the env.orig file on disk, so why won't the reverse work?
What am I doing wrong?
Update 1:
After looking at the Thor source thor\actions.rb it became clear that Thor uses different paths (not your current project path) for the source and destination. Furthermore my copy was actually not working, it was actually coping the ERB template file, not the already generated file.
After a breather it occurred to me use the right tool for the job so now I have: run 'cp environment.rb environment.~' and run 'mv environment.~ environment.rb' which works just fine. I am fairly certain this would not work on a windows box without the unix tools installed, but I can live with that. Does anyone have a better way?
See my Update for a Why, but the solution was to use the right tool for the job so now I have: run 'cp environment.rb environment.~' and run 'mv environment.~ environment.rb' which works just fine. I am fairly certain this would not work on a windows box without the unix tools installed, but I can live with that.

"rails" command on windows

So I installed Ruby On Rails using the Windows Installer.
Now the startup guides says I have to start up an Terminal and run the Rails command to make a project. I don't have a terminal, so how do I execute a Rails command and make a project??
The CMD command line in Windows does not recognize "rails"
I don't think it is an PATH problem, because when I'm in the "Bin" directory, there is "rails.bat" and "rails" with no extension. If I run Rails.bat I get "The filename, directory name, or volume label syntax is incorrect."
I get that message with whatever Argument I pass to it.
It seems to be a bug in the rails.bat file because of double-quotes, like:
#"ruby.exe"" "%~dpn0" %*
Remove the double quotes:
http://sepitfalls.blogspot.com/2008/12/updateing-rubygems-broke-gem-command.html
To get a terminal
Start > Run... or Windows key + R
Type "cmd" and hit enter.
To add a folder to the command line's path
On Windows XP (Vista is similar)
Start > Control Panel > System
Click the "Advanced" tab
Click "Environmental Variables"
Under "System Variables" double click on Path and edit accordingly.
You will need to open a new command line in order to get the updated path to take affect. With XP, I've had to reboot to force it to take affect but it shouldn't be necessary.
The Path variable is a semi-colon seperated list of folders in which the Command Line or "terminal" looks for commands.
You'll probably have to find the rails command yourself. I would try looking for a rails.bat or rails.cmd file.
I think they mean the command window. Try running it from a command line.
I dont know where the Windows Ruby on Rails intaller places its files, but the ultimately solution is that you need to make sure that the "rails" command is is your PATH - which you can view/modify by right-clicking My Computer, selecting Properties, going to the Advanced tab and then clicking on "Environment Variables" and then scrolling down until you see "PATH" and adjusting it accordingly. You probably need to find the directory where the "rails" command lives and append to the end of the existing PATH entry, inserting a ";" before you enter the new path to append it to the existing PATH.
So find where "rails" is and add its directory to your PATH.
You probably have to change your PATH in Windows to point to wherever the rails executable has been installed.
The PATH environment variable is used to determine where Windows looks for stuff; when you type, for instance, 'calc' Windows will hunt through its PATH and eventually find and run C:\Windows\calc.exe. In your case, the PATH doesn't include the directory you need, so Windows isn't searching in that directory for rails.exe when you type "rails."
To fix this, right click on "My Computer" -> "Properties" -> "Advanced" -> "Environment Variables" and then modify the PATH one to include the directory your rails.exe is in.
I recommend using cygwin for Rails development on windows - far too much of the community is using *nix. If you install the development tools package you'll automatically have svn, git and other doo-dads that you'll eventually need relating to various rails plugin installation. If you want to deploy using capistrano the installation is identical to all the instructions you find. Plus other tips and tricks people will reference will work exactly the same for you as it does for them, whereas some things are different for native windows and all the accessory tools have to be installed separately.

Resources