Unable to open the gem file on textmate "bundle open gem_name" - ruby-on-rails-3

I want to open the gem with textmate.
So I am using following commands:
export BUNDLER_EDITOR=mate
bundle open unicorn
Error:
Could not find gem 'unicorn' in the current bundle.
Note:
1)This commands used to work perfectly and it opened the whole gem with its contents, but suddenly some thing went wrong.
2) I am using rvm to manage my gems, & when i do : $gemset list, I do see the list of gems.
3) I also tried to automate the process by putting "export BUNDLER_EDITOR=mate" inside the ~/.profile file inside my user folder.
4) When i do -> echo $EDITOR , I dont get any output

I also faced the similar problem. Although i am not a pro, but you should try to use another rvm gemset, Instructions are listed here http://beginrescueend.com/gemsets/using/

Related

Using Custom OmniAuth Providers Images Not Loading

I've successfully created my first OmniAuth strategy and packaged it as a gem. I added this to the Gemfile in GitLab and ran bundle install --path vendor/bundle --no-deployment, which installed the gem.
Next I updated the gitlab.yml file by duplicating the section we have for GitHub and completing it with our own values.
As directed by the GitLab reference instructions at https://github.com/gitlabhq/gitlabhq/blob/5-3-stable/doc/install/installation.md
I then added two image files to the vendor/assets/images/authbuttons directory, all lowercase in the format of "strategyname_32.png" and "strategyname_64.png".
Finally I restarted GitLab and on the login page I now see a button for our new provider (which works, yea!) but the images that I uploaded aren't used for the button, instead a basic grey button is being used.
I cannot find anything in any of the logs indicating that it's not able to find the image files and I've tried renaming the files using various cases since this is on a Ubuntu system.
I also executed a rake assets:precompile RAILS_ENV=production but that didn't seem to make a difference.
Am I missing something to get this provider to be represented by our image instead of the basic HTML button on the login page? I don't see any steps that I've missed in the instructions.
It turns out this is "by design" that additional providers load as an HTML button and don't use a graphic placed in the path vendor/assets/images/authbuttons as mentioned in the installation instructions. This is because only providers listed in the default_providers() function within the app/helpers/oauth_helper.rb use images in the vendor/assets/images/authbuttons directory to display on the login page.
So for me to successfully use my custom omniauth provider and have a graphic element for the login link on the GItLab login page I did the following:
Stop GitLab sudo service gitlab stop
placed my two graphics in the vendor/assets/images/authbuttons directory
added my provider as one of the default providers in the default_providers() function of the app/helpers/oauth_helper.rb file
Added a section for my provider in config/gitlab.yml with the client_id and client_secret
Added my omniauth strategy to the Gemfile file
Installed the gem from the GitLab root directory using sudo -u git -H bundle install --without development test postgres --path vendor/bundle --no-deploy
Precompiled the assets from the GitLab root directory using sudo -u git -H rake assets:precompile RAILS_ENV=production
Start GitLab sudo service gitlab start

How can I run oink in heroku?

I'm having a problem running the oink gem on my app in Heroku. I've included it in my gemfile and gemfile.lock, uploaded those, and it installs. It even creates the oink.log (which I have no way of viewing, unfortunately). When I run
heroku run bundle exec oink --threshold=0 log/* --app my_app
I get
Running bundle exec oink --threshold=0
log/delayed_job.log log/development.log log/oink.log log/production.log log/test.log attached to terminal... up, run.3
/app/.bundle/gems/ruby/1.8/gems/oink-0.9.3/bin/../lib/oink/cli.rb:88:in get_file_listing':
Could not find "log/delayed_job.log" (RuntimeError)
from /app/.bundle/gems/ruby/1.8/gems/oink-0.9.3/bin/../lib/oink/cli.rb:86:ineach'
from /app/.bundle/gems/ruby/1.8/gems/oink-0.9.3/bin/../lib/oink/cli.rb:86:in get_file_listing'
from /app/.bundle/gems/ruby/1.8/gems/oink-0.9.3/bin/../lib/oink/cli.rb:59:inprocess'
from /app/.bundle/gems/ruby/1.8/gems/oink-0.9.3/bin/oink:4
from /app/.bundle/gems/ruby/1.8/bin/oink:19:in 'load'
from /app/.bundle/gems/ruby/1.8/bin/oink:19
I've tried running each of the individual files, too, and get the same result. This command runs fine on my local machine.
In my production.rb file, I have
config.logger = Hodel3000CompliantLogger.new(config.paths.log.first)
config.middleware.use( Oink::Middleware )
as configuration.
Can you enlighten me on what I'm doing wrong here? My understanding is that the logs are read only, but I don't know if that means they're only accessible through the heroku logs command. If there's a way I can see the oink.log file, too--knowing how to do that is also appreciated, or knowing how to see it in the actual Heroku log using heroku logs.
UPDATE: The configuration for oink shown above allows the commands to be run successfully on my localhost.
Thanks!
-Andrew

How to create an RVM environment on a server through net-ssh?

I have a script which is installing Ruby/RVM (and more) on my server to get an environment ready to deploy a Rails project. This script is in ruby and use the net-ssh lib to do the job.
After having installed RVM, Ruby, I would like to create the project Gemset:
connection do |conn|
logger("Create RVM environment #{ruby_version}##{project_name}")
conn.exec!("#{rvmsudo_path} #{rvm_path} gemset create #{project_name}")
end
I get my gemset created under, all good:
/usr/local/rvm/gems/ruby-1.9.3-p286#my_project_name
Here is my Capistrano setting for rvm/ruby:
set :rvm_type, :system
set :rvm_ruby_string, ENV['GEM_HOME'].gsub(/.*\//,"")
When I'm trying to deploy using capistrano, I get:
/usr/local/rvm/environments/ruby-1.9.3-p286#my_project_name: Permission denied
The environment file 'ruby-1.9.3-p286#my_project_name' is actually missing in that folder. I need to log into the server and navigate to my project so the .rvmrc file to trigger the creation of the environment (rvm --create my_project_name). I would like to avoid this last step. Do you know how to trigger the creation of this environment? (I though it would create it when I have created the Gemset)
RVM has support for installing itself via capistrano, to install rubies and to create gemsets, you should make use of it:
https://rvm.io/integration/capistrano/#install_rvm
https://rvm.io/integration/capistrano/#install_ruby
Basically the RVM environment need to be loaded to be able to script it remotely.
https://rvm.io/workflow/scripting/
You can run the following command with net-ssh to do so:
conn.exec!("source "/usr/local/rvm/scripts/rvm; rvm --create ruby-1.9.3-p286#my_project_name")
It will create your environment and associated gemset.

How do I ensure my jruby command line options are used when running "rails", "rake", "rspec" etc?

I currently run my Rails app using:
jruby --1.9 -J-XX:+CMSClassUnloadingEnabled -J-XX:+UseConcMarkSweepGC -J-XX:MaxPermSize=256m -S rails server
This is getting pretty old now. How can I set my Rails project up so that just running
rails server
has the same effect?
(Note: bash aliases and the like are not what I'm looking for here. I want to make the project work right, not fix my local settings)
When using RVM and a project .rvmrc, the canonical way is to set PROJECT_JRUBY_OPTS in the project .rvmrc. A bug prevented this from working for me, so use rvm head.
If not using rvm then use JRUBY_OPTS, which is the built-in way of doing it that JRuby checks (in fact, the PROJECT_JRUBY_OPTS thing ends up being converted to JRUBY_OPTS by rvm).

rvm install fails with or without rvmrc

I'm using rvmrc with the following text:
rvm_path=/local/rvm
(on Ubuntu 11.10) but trying to install gives an obscure error:
$ bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)
Successfully checked out branch ''
Current branch master is up to date.
Successfully pulled (rebased) from origin
: No such file or directory
Any ideas?
You have no need at all to set $rvm_path. You're using a multi-user install. Please follow the explicit instructions for the Multi-User install at https://rvm.io and remove any existing installations, remove /etc/rvmrc, /etc/profile.d/rvm.sh, and $HOME/.rvmrc. Comment out any RVM sourcing lines in your .bash_profile, and .bashrc and log out of the machine then back in. Then reinstall correctly. Setting the rvm_path has never been a requirement of the installer UNLESS you already have a Multi-User working installation in place, and you want to attempt to use a per-user install with it. THEN you would preset the $rvm_path to $HOME/.rvm in your own $HOME/.rvmrc, log out then back in and then attempt the install again. BUT, that is not a supported installation type. Which is why 99.999% of users will not need to set rvm_path at all.
The real problem was that the git configuration for auto-converting line endings was not set correctly which prevented any installation from working. It had nothing to do with using rvmrc settings.
The fix for this is simple (and comes straight from the github help page):
$ git config --global core.autocrlf input
Line endings are important in linux and by forgetting that setting, everything the rvm-install script was pulling from github had \r\n endings. I made that change so long ago on my work machine, I didn't even remember it -- but it was not set on my home system.
I'll leave it up in case someone else has the same problem.