i couldn't find anywhere if vlad it's compatible with Rails 3, but i tried to deploy a new rails 3 app that we're developing and always returns the same error:
Error loading vlad: no such file to load -- vladrake aborted!
Don't know how to build task 'vlad:init_setup:production'
I'm using ruby 1.8.7 (2010-08-16 patchlevel 302) [i686-darwin9.8.0]
And rails 3.0.1 and i testit with vlad 2.0.0 and vlad 2.1.0
In the Rakefile i have this:
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('../config/application', __FILE__)
require 'rake'
begin
require 'rubygems'
require 'vlad'
Vlad.load :scm => :git, :app => :passenger
rescue LoadError => e
$stderr << "Error loading vlad: #{e}"
end
If anyone has an idea where to look at it in order to fixit or maybe tell me if vlad it's rails 3 ready?
Thanks in advance for your time
Cavi
Maybe you already figured this out, but do you have vlad included in your Gemfile? You probably want to add:
group :development do
gem 'vlad-git'
gem 'vlad'
end
Then run bundle.
Related
I was unable to run my rails server in development mode. I have installed two gems are resque and resque-scheduler into rails application. I have searched for the solution online but still, I was struggling with it.
Gemfile:
gem 'resque'
gem 'resque-scheduler'
Config file of application:
config.active_job.queue_adapter = :resque
The resque.rake file:
require 'resque/tasks'
require 'resque/scheduler/tasks'
namespace :resque do
puts "Loading Rails environment for Resque"
task :setup do
require 'resque'
require 'resque-scheduler'
Resque.redis = 'localhost:6379'
end
end
I am trying to use the gem gchartrb to create some graphs/charts in my RoR application.
I have looked into several tutorial and all say the same thing, that I have to add
require 'google_chart'
But I am getting the message:
no such file to load -- google_chart
I have the require inside my controller, I have confirmed that the gem is installed.
I am using Rails 3.
Also, I have tried adding config.gem 'gchartrb', :lib => 'google_chart' in my environment.rb as suggested here but nothing changed
Thanks for your help
EDIT:
I have also tried with the gem googlecharts, what I have in my Gemfile is:
gem "googlecharts", :require => "gchart"
but I get no such file to load -- gchart when I try to load the view.
I am not sure, it is required now or not. But it worked for me in Rails 3 as well. I am using Rails 3.0.10. I added below 2 lines and it worked for me.
1) gem 'gchartrb' in Gemfile
2) require 'google_chart' in config/boot.rb
Hope it helps!
config.gem is for rails 2.3.X.
For rails 3, you will need to add the gem to your Gemfile and run gem bundle
You may also need to check that the google_charts gem actually supports Rails 3...
Given that the latest code update seems to have been in 2008 - that might not actually be likely. :(
You can try it anyway and see...
I have a Rails 3 app that I am turning into a Rails engine / gem.
This engine has some gem dependencies that I have put inside it's .gemspec file.
I have created a new 'parent' Rails 3 app, and I would like to add my engine gem to the Gemfile and have the gem's dependencies automatically 'loaded', but this does not work for me! bundle install installs the gem dependencies fine, but when I start the server, the app crashes because they are not loaded.
For example, my engine's gemspec contains these lines:
s.add_runtime_dependency(%q<rails>, ["= 3.0.7"])
s.add_runtime_dependency(%q<acts_as_commentable>, [">= 3.0.1"])
s.add_runtime_dependency(%q<haml>, [">= 3.1.1"])
.. and the parent Rails 3 application has these lines in its Gemfile:
source 'http://rubygems.org'
gem 'my_engine', :path => "~/src/gems/my_engine"
But I get the following error:
undefined local variable or method `acts_as_commentable'
from /home/user/src/gems/my_engine/app/models/account.rb:66:in `<class:Account>'
But if I add gem 'acts_as_commentable', '>= 3.0.1' to the Gemfile of the parent Rails 3 app, then the gem is loaded and the error disappears.
I am using Rails 3.0.8.
Does anyone have any suggestions? Do I need to change something about the way my engine is loading?
During main Rails app boot, Bundler will only require dependencies directly listed in the Gemfile but not any sub-dependencies. It's your library's/Engine's responsibility to require its dependencies when it itself gets required. You can do so using initializers in your Railtie.
class MyRailtie < Rails::Railtie
initializer "require stuff" do
require "stuff"
end
end
In our Rails Engine we used a small trick to require dependencies automatically. Unfortunately you can't specify whether or not they should load in the .gemspec, which would allow for greater control.
Gem.loaded_specs["our_rails_engine"].dependencies.each do |d|
begin
require d.name
rescue LoadError => le
# Put exceptions here.
raise le if d.name !~ /factory_girl_rails/
end
end
I'm looking at Spree (the superhero of Rails Engines!), and they do this in spree_core-0.60.1/lib/spree_core.rb:
require "rails/all"
require 'state_machine'
require 'paperclip'
require 'stringex'
require 'will_paginate'
require 'nested_set'
require 'acts_as_list'
require 'resource_controller'
require 'active_merchant'
require "meta_search"
require "find_by_param"
So the answer is that within your gem, you have to require all of it's gem dependencies one by one. Well, that's how I will do it for now. But please comment if this ever changes in the future.
Seems it don't work, i create a host project and a sub-project with rails 3 engine.
Added the gem to engine's gemspec
s.add_dependency 'simple_form'
then added the require to engine_name.rb like below
require 'simple_form'
But if delete the line [gem 'simple_form'] in host project's Gemfile, it will show undefined immediatly
I'm likely doing something very simply wrong, but I'm not quite sure what it is. I am porting a rails 2 application to rails 3. This application uses webmock for a bunch of it's tests.
If I include
gem 'webmock'
In my Gemfile, the tests pass, but when I start the server and run the app locally, hitting a controller that should make a web call throws an error:
WebMock::NetConnectNotAllowedError
If I do NOT include the line in my Gemfile, then when I run the app locally, it works fine, but the tests error out with:
`require': no such file to load -- webmock (LoadError)
When this line is hit in my test_helper.rb
require 'webmock'
I'm guessing I've got something configured wrong, but I haven't hit the right google incantation to shed any light on it yet. Where I did I go astray?
Thank you.
Try telling your Gemfile to only load webmock when you're in a test environment:
group :test do
gem "webmock"
end
On my Ruby 1.9 Rails 3 instance I have something like the following:
group :test do
gem "mocha"
gem "webmock"
end
group :development do
gem 'ruby-debug19', :require => 'ruby-debug'
end
I am trying to use the Sunlight API gem with a Rails project. I have installed the gem and can successfully use it from irb.
However, when I put the require statement (require 'sunlight') in sunlight.rb in config/initializers, I get the following error:
/opt/local/lib/ruby/gems/1.8/gems/activesupport-3.0.0.beta3/lib/active_support/dependencies.rb:209:in `require': no such file to load -- sunlight (LoadError)
I checked the permissions on the gems directory, and it is world readable/executable.
Here is the code from sunlight.rb:
require 'rubygems'
require 'sunlight'
Sunlight::Base.api_key = 'bb7b775755054c54aa9715d202f6785c'
Can anyone tell me how to fix this? TIA!
Is sunlight listed in your Gemfile? Rails3 uses Bundler to manage Gem installations.