I find that browsing source code of open source libraries being used in projects is invaluable. Unfortunately, I find this difficult when developing with ruby on rails. I am accustomed to working inside IDE's that allow me to jump to the definitions of symbols, regardless of whether they are part of an external library.
I use Aptana Studio 3 on Mac OS X to develop, but would be willing to change IDEs for this feature.
I have explored https://github.com/fnando/gem-open as an option, but have yet to find a good editor to integrate this with. Can anyone recommend one? Anyone else have a good method for browsing the sources of gems?
Aptana Studio 3 has a command line launcher: studio3.
Add the following to your ~/.bash_profile:
export PATH="/Applications/Aptana Studio 3:$PATH"
export GEM_EDITOR="studio3"
Reload your existing shell environment: . ~/.bash_profile and then you can use gem-open with your preferred editor: gem open rails
Related
I'm using mac, and I'm in search for a new free editor to use. I'm familiar with vi from college days a bit rusty with the Vi commands.
Can someone tell me, what is a good free vi editor to use on a mac, and a good link to top vi commands?
type brew install macvim into a terminal (or install macvim some other way)
This will install macvim on your computer, which you can now use by typing vim in a terminal.
type vimtutor in a terminal to start a guide on how to use vim,
or whilst inside vim, type :e /usr/share/vim/vim74/tutor/tutor to open to open the guide.
I suggest you using NeoVim as I'm daily using it. Because of:
Simplify maintenance and encourage contributions
Split the work between multiple developers
Enable advanced UIs without modifications to the core
Maximize extensibility
I think NeoVim is the most active project which bases on Vim and it is free for sure: https://github.com/neovim/neovim
For the tutorial, the easiest way is type vimtutor on the terminal, all the commands you need are there.
Issue
I am using xray-rails gem in a rails app and want it to open rubymine to the correct file when I click it in the browser. It was unclear how to configure this. xray-rails gem uses open3 to open the file in the editor.
Solution
Prerequisite: Follow the instructions for setting up rubymine to be callable from the commandline found in Running RubyMine as a Diff or Merge Command Line Tool
NOTE: This is also a handy use of rubymine, allowing it to perform diffs between files. Nice bonus for researching a solution to my problem.
Create ~/.xrayconfig with content...
:editor: mine
NOTE: mine is the name of the script created in the prerequisite steps. If you named your script something different, use that name in place of mine.
Now when you start xray-rails in your browser and click, the corresponding file will open in rubymine.
I can't seem to get Forge to work.
I'm using VS Code 1.6.1 with Ionide-F# 2.8.2. Until now I've only compiled scripts, but I need a project file for a specfic .dll to work (Unmanaged Exports).
However I can't seem to get an F# project going with Forge. When I use the `>F# New Project" command it tells me I need to refresh my templates, because I don't have any.
If I refresh, nothing happens. I have git installed as was suggested in other places, but to no avail.
When I open Forge.exe directly from my C:\Users\>USER<\.vscode\bin-forge directory, it doesn't even go into interactive mode. I downloaded Forge separately with the same result.
Has anyone else encountered this issue?
I'm not sure why it's working now, the only thing I can remember doing is adding the following to my user settings:
"FSharp.toolsDirPath": "C:/Program Files (x86)/Microsoft SDKs/F#/4.0/Framework/v4.0",
"FSharp.fsiFilePath": "C:/Program Files (x86)/Microsoft SDKs/F#/4.0/Framework/v4.0/Fsi.exe"
Maybe Forge didn't find the F# tools, but they're on the windows path, so I can't fathom why it helped.
I've been using this guide
Whenever I go to import the module I get this screen:
I used the following file path, maybe this is whats wrong?
/usr/local/Cellar/ruby-build/20160130/share/ruby-build/2.3.0
And got this error:
I'd appreciate any ideas anyone might have, i've been trying get this working all night!
I ran into this problem with Intellij IDEA 2020.2. It took a while to resolve because the Intellij documentation seems to be missing one critical piece.
When you first open a project in IDEA, it assumes all your code is part of a Java module. With that module in place you cannot set a Ruby SDK at the module level. There's no option to do because the existing module is configured as Java.
Here's a screenshot of my example project with the default Java module. Notice the icon is a folder with a blue rectangle in the lower, right corner.
Here's what I had to do.
Open the Project Structure dialog (File | Project Structure).
In the Modules settings, highlight the top-level project module and click the delete button (looks like a minus sign).
Click the plus sign to add a new module.
From the pop-up click "New Module".
In the "New Module" pop-up select Ruby and the correct Module SDK (e.g. rbenv: 2.5.0)
When you are prompted to enter the Module name, Content root, and Module file location, make sure the directories are set to your project's root. When I entered the module name it appended the name to the project's root directory which is probably not what you want.
Once you've done that the module should appear with a Ruby icon on it and the rest should work as documented here: https://www.jetbrains.com/help/idea/configuring-language-interpreter.html
Here's a screenshot of my new Ruby module. You can see the Ruby icon replaced the blue rectangle.
I hope this saves you some time!
In order to set Ruby SDK for your project in IDEA you need to go to File | Project Structure | Project Settings and set project and module SDK.
Olivia is correct, the "Project Structure..." (Mac shortcut Cmd+;) is the dialog for configuring the IDE to use different ruby installations.
The first requirement is that the ruby manager (chruby, rbenv, rvm) is configured properly.
Another concern is exactly where and how jetbrains expects the ruby installation to be organized. I wonder if Intellij is compatible with the way ruby-install lays out ruby? That's the one I used with chruby. I could not make it work.
The posted url to Opening Rails projects in IntelliJ IDEA helped me feel the most confidence that we are on the right track. :)
At the time, I was failing to get Intellij configured due to fact the gem files were not seen by the IDE. All but about 4 gems in my project's Gemfile was being highlighted as having an SDK problem.
To end this, I stopped using chruby and ruby-install. I am not blaming chruby, however I could not make the chruby system work properly with the IDE. It worked fine in the shell. Note, I am a previous user of rvm and rbenv. Switching back to rbenv, now. Note that I've also stopped using ruby-build directly.
Instead, I built the first ruby version directly from rbenv:
rbenv install 2.3.1
Next, I created the .ruby-version file in the root of my rails project directory by running:
rbenv local 2.3.1
To help with any confusion regarding the minimum support needed in the shell startup scripts. Do not alter PATH at all. Place the following in your shell startup script system, whatever that may be:
# rbenv config in my .bash_profile
# --------------------------------
if which rbenv > /dev/null; then
eval "$(rbenv init -)";
fi
With the prerequisites out of the way...
I recommend doing the project import in the same way described in the jetbrains tutorial Opening Rails projects in IntelliJ IDEA.
In the first screenshot from thesowismine, I see two dialogs for different purposes that are simultaneously open. Unless I am mistaken, one of those dialogs should have received its info and closed before going forward, at least during the wizard-like process. Perhaps this was done and that dialog was reloaded later?
In any event, that is not where the Ruby SDK is associated to a Rails project. The screenshot indicates the User is browsing around the brew Cellar, which may indicate two things.
Ruby was installed with a brew install <version> command; I installed ruby by calling the rbenv ecosystem.
That particular dialog is for informing the IDE about the Rails project folder, not the Ruby kit.
Assuming the first dialog is provided with the root directory of the Rails app and next is clicked; then in the second dialog, I change nothing and click next. The 3rd dialog is where I confirm the project directory is correct and I can assign a more elaborate name (which is displayed in the IDE's project menu). Clicking next may prompt you to write over the ".idea/" directory. Say yes. The next dialog confirms that sources were found. Click next. Now Frameworks begin to be detected assuming the Ruby Manager is setup correctly. Click Finish.
Now, goto the "Project Structure..." dialog to set the SDK.
Before or after setting the SDK, go to the the project directory of your Rails project, run:
gem install bundle
bundle install
This will install all the gems your project requires including the rails gem, as presumably it is listed in your Gemfile.
Note that gemsets do not come up, here. In this config, the set of gems are associated to a particular Ruby installation. Bundler is your friend.
Languages & Frameworks > Ruby SDK and Gems
I was able to solve this by doing:
Preferences | Plugins | Install JetBrains plugin
In my Ruby on Rails application, I am using xsltproc command-line tools. These work on my development machine, but are not working on Heroku, the deployment platform I am using. I asked Heroku support a question about it, and here is what they said:
Hi– can you try compiling xsltproc as a standalone static binary and deploy that as part of your application?
If I knew what that meant, I probably wouldn't be here. I am guessing it means make a file with all the xsltproc code and call that for the xsltproc commands. I have no idea how to do that. Can anyone help?
If anyone wants to use xsltproc command-line tools on Heroku, don't do it. I was able to use the Nokogiri gem, along with the built in XPath functions to do everything I need.