where's the Gemfile in a rails 1 application - ruby-on-rails

Where's the Gemfile located in a rails version 1 application?
I looked in the root of the app, it has Rakefile but not Gemfile.

try searching for "gemfile" from your root folder. I have never used rails 1 before, so no idea!

Related

Use gem as library in Rails 4

Is there a way to use a gem as a library in Rails 4?
I have tried putting in a gem folder after cloning into lib folder but this doesn't seem to be working
You can set local path to gem in your Gemfile if I clearly understood the problem.
# Gemfile
gem 'my_perfect_gem', path: './path/to/my_perfect_gem'
I think it's better to set local gem location only in development and test environments, so wrap this line in a group. Unfortunately you should restart your rails server any time you've updated the gem.
May be there is a better approach such as using your gem as a part of application in lib folder – Auto-loading lib files in Rails 4

Rails Installation of Spree Commerce

Hello im creating my first spree commerce and i did this
rails new spreecommerce
cd spreecommerce
i added this to Gemfile
gem 'spree_auth_devise', github: 'spree/spree_auth_devise', branch: '2-0-stable'
rails g spree:install
rails s
now i can browse products and categories but /admin URL doesnt work.
so i tried
rake spree_auth:admin:create
but it says an error
rake aborted!
Don't know how to build task 'spree_auth:admin:create'
Im too wonder where are controllers and views located ? not in spreecommerce/ directory where i installed application, how can i edit that app ?
if i run rake routes in spreecommerce/ directory i can see admin route
admin admin/(.:format) spree/admins/orders#index
but i dont have spree directory in that folder ?
You'll need to run a bundle install after modifying your Gemfile. That should make the spree_auth rake tasks available.
The controllers and views are all stored in the Gemfile. You can execute bundle show spree_auth_devise to see where they are located on your system. Note that you should not modify those files directly, as those changes won't be able to be deployed to a different environment. You can refer to the Spree Developer Guide for more information on how to customize the controllers and views if you need.

Rails does not load gems from vendor/gems

I have strange old buggy project on Rails 2.
It have gem's dependencies in config/environment.rb like
config.gem "andand"
config.gem "json"
config.gem "chronic"
config.gem "mini_fb"
all those gems are located in vendor/gems/
andand-1.3.3/
chronic-0.6.7/
json-1.7.3/
mini_fb-1.1.7/
rbet-1.0.3/
redis-3.0.1/
responsys_client-0.0.1/
but when i start unicorn server with this app it always complain that it can't find this gems. Why?
UPDATE
After building and installing gem from vendor/gems rails still complain about it.
I have tweake mini_fb gem into custom mini_fb_custom gem. Changed all references in gemspec and other files from mini_fb to mini_fb_my, installed it and it is shown in gem list as mini_fb_my. But it fails to load from config/environment.rb and complains that
Missing these required gems:
mini_fb_my >= 0
maybe i should rename lib/mini_fb.rb to lib/mini_fb_my.rb
i'll check it.
UPDATE 2
Yes, renaming files rocks!
You still need to install them from those folders, or unicorn will not know where to look for them.
Just install the gems from that directory and unicorn should pick them up.
UPDATE
You can install your gems locally with this command
gem install --local vendor/gems/gem/gem-name.gem
On more recent versions of rails you just specify path on the Gemfile
gem "gem-name", path: "path/to/gem"
My advice: replace the obsolete gem configuration with bundler (it works fine with rails 2, there should be a tutorial for rails 2 available on their website).
Configuration through gem command, freezing gems, etc. is just pain in the a** and it seemed kinda buggy to me when I'd used it (long time ago).

Rails 3.1rc4 and 404 not found when accessing assets

I'm trying to port my rails 3.0.7 project to rails 3.1
I have Phusion Passenger running on nginx + rvm.
There is config.assets.enabled = true in my application.rb file.
I created empty rails 3.1 project and copied my app directory, routes.rb and application.rb files over it. I moved everything from public to app/assets (app/assets/stylesheets etc).
When I'm trying to access assets (application.css/application.js), I'm getting 404 not found error, but I can see them in app/assets/stylesheets/application.css and app/assets/javascripts/application.js.
Help me please.
UPD: Thanks to Devin M for the idea, I removed css,js,gif,png and jpg extensions from nginx.conf ("serve static files directly") and everything started to work.
I came to this question with a similar problem (everything was giving a 404) I found that Rails 3.1.0.rc4 has a problem with gem 'sprockets'
In your Gemfile set:
gem 'sprockets', '= 2.0.0.beta.10'
Note: you may have to manually override your Gemfile.lock before you bundle install
Usually this is a problem with the nginx config not set up to serve things correctly. Double check your config files.

Detect rails 2 app

I need to detect rack apps and rails 2 apps by simply inspecting the files in a project.
I've been able to do this for rack apps by checking for the existence of a config.ru file. Is there something similar I could check for in a rails 2 app?
From Phusion Passeger documentation: Phusion Passenger checks whether the virtual host is a Rails application by checking whether the following file exists:
dirname(DocumentRoot) + "/config/environment.rb"
This file exists also for rails 3 projects if that is a problem :/.
In config/environment.rb you can look for RAILS_GEM_VERSION = '2.x.x'
In Gemfile.lock for rails (2.x.x)
In Gemfile for gem 'rails', '2.x.x'
The file config/environment.rb should have a statement which mentions the required version of rails, e.g.:
# Specifies gem version of Rails to use when vendor/rails is not present
RAILS_GEM_VERSION = '2.3.5' unless defined? RAILS_GEM_VERSION

Resources