How do I configure config.yml so that I can install devkit? - ruby-on-rails

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\Aaron>cd /DevKit
The system cannot find the path specified.
C:\Users\Aaron>cd \DevKit
C:\DevKit>ruby dk.rb init
Initialization complete! Please review and modify the auto-generated
'config.yml' file to ensure it contains the root directories to all
of the installed Rubies you want enhanced by the DevKit.
C:\DevKit>ruby dk.rb install --force
Invalid configuration or no Rubies listed. Please fix 'config.yml'
and rerun 'ruby dk.rb install'
C:\DevKit>
The config.yml looks like this:
# This configuration file contains the absolute path locations of all
# installed Rubies to be enhanced to work with the DevKit. This config
# file is generated by the 'ruby dk.rb init' step and may be modified
# before running the 'ruby dk.rb install' step. To include any installed
# Rubies that were not automagically discovered, simply add a line below
# the triple hyphens with the absolute path to the Ruby root directory.
#
# Example:
#
# ---
# - C:/ruby19trunk
# - C:/ruby192dev
#
---
I am completely stumped I have no clue what to do. Can someone tell me how to resolve this problem?

Yeah I don't think it could possibly be more vague. Basically, it's asking for one reference to your ruby installation. Mine lives in my Program Files directory since I prefer to keep all installed stuff in one spot, rather than straight on the C drive like is default (I'm on windows).
So, since my Ruby installation path is:
C:\Program Files\Ruby200-x64
My entire config.yml file is the following:
# This configuration file contains the absolute path locations of all
# installed Rubies to be enhanced to work with the DevKit. This config
# file is generated by the 'ruby dk.rb init' step and may be modified
# before running the 'ruby dk.rb install' step. To include any installed
# Rubies that were not automagically discovered, simply add a line below
# the triple hyphens with the absolute path to the Ruby root directory.
#
# Example:
#
# ---
# - C:/ruby19trunk
# - C:/ruby192dev
#
---
- "C:/Program Files/Ruby200-x64"
Note, I put my Ruby filepath in quotes because it contains a space. If your path doesn't contain a space, then you won't need it.
I can see this being colossally confusing for a lot of people, so I hope this helps.
update
I'm seeing that spaces in file paths causes issues, so I've moved mine back down to the c:\ drive just because I don't want to deal with it. I recommend staying away from spaces in file paths unless you're willing to troubleshoot issues down the line.

So... that file is asking you to point to your ruby installation.
for me... mine looked like:
- C:\RailsInstaller\Ruby2.0.0

Write your path to ruby installation folder
The pattern is three dashes then move to next line
Add another dash, space and path
---
- C:\Ruby21-x64
(Since you can see three dashes have already been put at the
end of your config.yml file so you basically need to add the last line)

watch out of blank spaces! My problem was this maybe can be yours too !

You have to use slashes "/" instead of backslashes "\" on windows.
Worked for me on Win7x64

Related

Ruby on Rails - bin files shebang causing issues (Mac)

So for the files in the /bin directory of a normal rails installation (bin/rails, bin/rake, bin/bundle), the shebang at the top of the file is:
#!/usr/bin/env ruby.exe
But when I run bin/rails, for example, I get the error:
env: ruby.exe: No such file or directory
When I remove the .exe from the end of the shebang, everything works fine. But I was just curious:
Why is this necessary
How to deal with versioning, since the other developer working on this doesn't need to remove the .exe. It's suggested to keep the bin folder in the repo, so I'd prefer to just get the .exe version working if anything.
There are no .exe files on Mac OS X or on Linux. On those platforms the Ruby executable is just called ruby.
For compatibility to those operating systems, your first line should look like this:
#!/usr/bin/env ruby

Add TeX path to R Studio - Ubuntu

I'm having the same issue as this question:
When I open any .Rnw file, R Studio says that I have no TeX Distribution installed: I'm using Ubuntu 14.04 w/ Gnome and TeXLive 2014.
I include the line PATH=/usr/local/texlive/2014/bin:${PATH} in the Renviron.site file, which now looks like:
## Emacs please make this -*- R -*-
## empty Renviron.site for R on Debian
##
## Copyright (C) 2008 Dirk Eddelbuettel and GPL'ed
##
## see help(Startup) for documentation on ~/.Renviron and Renviron.site
# ## Example ~/.Renviron on Unix
# R_LIBS=~/R/library
# PAGER=/usr/local/bin/less
# ## Example .Renviron on Windows
# R_LIBS=C:/R/library
# MY_TCLTK="c:/Program Files/Tcl/bin"
# ## Example of setting R_DEFAULT_PACKAGES (from R CMD check)
# R_DEFAULT_PACKAGES='utils,grDevices,graphics,stats'
# # this loads the packages in the order given, so they appear on
# # the search path in reverse order.
PATH=/usr/local/texlive/2014/bin:${PATH}
However the problem persists. How can I fix this and run Sweave or knitR?
If anyone faces the same problem, I opened R Studio and checked the pdflatex installation with
> Sys.which("pdflatex")
pdflatex
""
Which show that it is in fact empty, so I run the command Sys.getenv("PATH")to check the current PATH:
Sys.getenv("PATH")
[1] "/usr/local/texlive/2014/bin:/usr/local/texlive/2014/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
To add my pdflatex Path, I had to find the pdflatex file on my texlive directory, which was /usr/local/texlive/2014/bin/x86_64-linux, then I added this to my current Path:
> Sys.setenv(PATH=paste(Sys.getenv("PATH"),"/usr/local/texlive/2014/bin/x86_64-linux",sep=":"))
And now it works perfectly
EDIT: the solution above works only for the open session and is only temporary, you have to run the code everytime you open a new session. I'm still trying to find a permanent solution
see this page: Customizing Startup, modify this file /usr/lib/R/etc/Rprofile.site, and put your code in this file. It looks like a permanent solution maybe.
===
i saw this file /etc/environment is the same as the output of Sys.getenv("PATH"), so i think that sys.getenv("PATH") reads file /etc/environment.
Therefore the better way is to modify this file /etc/environment adding this code :/usr/local/texlive/2017/bin/x86_64-linux​.
after i did it, i tried source /etc/envronment and restarted Rstudio, but it didn't work.
Finally it makes sense after i restarted my ubuntu system. ^_^
I hope my poor English expression is clear enough.

Updated my path and now my program can't find my gems

I was having some trouble installing the gem libv8. Apparently I need to have python installed. I installed Python and was attempting to update my path with command from another forum:
SET PATH=C:[Ruby Directory]\bin;C:[Python Directory]
or in my case:
SET PATH=C:\Ruby192\bin;C:\Python27
I am not strong with paths and I can't figure out what I did. Now my environment can't find my Ruby directory.
Can someone explain what I did and how I might fix it?
That is most likely because your PATH variable already had a bunch of stuff that you simply throwed away with that line:
echo %PATH%
# a bunch of stuff
SET PATH=C:\Ruby192\bin;C:\Python27
echo %PATH%
# C:\Ruby192\bin;C:\Python27
You can try to append to it instead instead:
set PATH=%PATH%;C:\Ruby192\bin;C:\Python27
echo %PATH%
# a bunch of stuff plus C:\Ruby192\bin;C:\Python27
This change will be avalid for your terminal session only. Closing it and open again should restore the default path. If you need to make it permanent, you need to change your path throught the windows (for example, following this instructions)

Error while installing jruby on windows 7

I am trying to install JRuby in my system, I follow the following steps:
Download a copy of the latest JRuby from the JRuby download page.
Unzip the file with your achive program. If you don't have one that works, download 7-Zip.
Copy the JRuby folder called jruby-1.7.2 directly to "C:/"
Set environment variables on your system. Right click "My Computer" go to "Advanced" then "Environmental Variables". Create these: JRUBY_HOME = C:/jruby-1.7.2
Next you'll have to edit the PATH variable. Add ;C:\jruby-1.1.5\bin; to the end of that variable.
And then I am running the command:
C:\Users\sitanshu\rubyApp\jruby-1.7.2>jruby -v
then it shows the following error:
jruby 1.7.2 (1.9.3p327) 2013-01-04 302c706 on Java HotSpot(TM) Client VM 1.7.0-ea-b19 [Windows Vista-x86]
NameError: uninitialized constant Java::JavaLang::ProcessBuilder::Redirect
const_missing at org/jruby/RubyModule.java:2677
ProcessManager at file:/C:/Users/sitanshu/rubyApp/jruby-1.7.2/lib/jruby.jar!/jruby/kernel/jruby/process_manager.rb:12
JRuby at file:/C:/Users/sitanshu/rubyApp/jruby-1.7.2/lib/jruby.jar!/jruby/kernel/jruby/process_manager.rb:6
(root) at file:/C:/Users/sitanshu/rubyApp/jruby-1.7.2/lib/jruby.jar!/jruby/kernel/jruby/process_manager.rb:3
load at org/jruby/RubyKernel.java:1046
(root) at file:/C:/Users/sitanshu/rubyApp/jruby-1.7.2/lib/jruby.jar!/jruby/kernel.rb:1
So where am I going wrong and what is the solution for that?
I would test that java is updated and working
java -version
Under your environment variables, make sure you have a JAVA_HOME variable pointing to your JRE root folder, like this:
C:\Program Files\Java\jre7\
Make sure your Java JRE bin folder is also part of your PATH variable:
;C:\Program Files\Java\jre7\bin\
Additionally, when you are adding jruby to your PATH variable, make sure you are referencing the correct folder location. In the example you have given, you are installing jruby to C:\jruby-1.7.2, but then you are actually referring to this different folder C:\jruby-1.1.5 in your PATH configuration.
Also, when you are defining your JRUBY_HOME variable, make sure you are using backslash \ characters. In your example above you used a forward slash / character. Remember, that windows uses backslashes between folders.
Finally, after you've made all your environment variable changes, remember to open a new command window for your changes to take effect.

.gemrc file specification

I searched everywhere to find the .gemrc file specification but I haven't succeed.
Does anyone know where I can find it?
gem looks for a configuration file .gemrc in your home directory, although you can specify another file on the command-line if you wish (with the --config-file modifier).
There are three things you can specify in the configuration file:
command-line arguments to be used every time gem runs
command-line options for ’’RDoc’’ (used when generating documentation)
GEM_PATH settings
More at gem environment command doc.
'Home' is a Linux/Mac term. What is refers to is the folder where a user's settings appear. You can find out where your settings directory is by doing the following:
on Unix/Linux, open a terminal and type the following command:
echo $HOME
on Windows, open a command-prompt and type the following command:
echo %USERPROFILE%
For me (in Windows 7), this is C:\Users[name]. However, looks like Ruby doesn't set up your .gemrc in that folder by default. Instead, you have to create the file. Open a text editor, copy the YAML style code you need (documentation), and save the file as .gemrc in your home directory (make sure you select all files, not '.txt').
These settings will only affect that individual user. If it's your personal computer, however, you probably don't need to change the settings for all users.
An updated gemrc specification is available at RubyGems Guides (under 'gem environment'). Note that /etc/gemrc applies to all users, while ~/.gemrc applies to an individual.
If the key is a gem command (for example, install:), it specifies arguments to be used with that command.
Here are the other keys that can be specified:
:sources: A YAML array of remote gem repositories to install gems from
:verbose: Verbosity of the gem command. false, true, and :really are the levels
:update_sources: Enable/disable automatic updating of repository metadata
:backtrace: Print backtrace when RubyGems encounters an error
:gempath: The paths in which to look for gems
All of the answers here at time of writing are wrong because the obnoxious website keeps changing. It is at this moment here:
https://guides.rubygems.org/command-reference/#gem-environment
Obviously you should expect it to change constantly at this point.

Resources