I'm quite new to ruby and ruby on rails and I'm trying to add Cucumber to my new rails 3 application.
My Gemfile contains this section:
group :test, :development do
gem 'rspec-rails', '~>2.5'
end
group :test do
# Pretty printed test output
gem 'cucumber-rails'
gem 'capybara'
gem 'database_cleaner'
end
To install Cucumber first I've run:
bundle install --binstubs
and after all my gems are installed I've run:
rails generate cucumber:install --rspec --capybara
My problem is that during installation of cucumber those changes are made:
create config/cucumber.yml
create script/cucumber
chmod script/cucumber
create features/step_definitions
create features/support
create features/support/env.rb
exist lib/tasks
create lib/tasks/cucumber.rake
gsub config/database.yml
gsub config/database.yml
force config/database.yml
but as I understand more files should be created (some helpers file) - like this:
create config/cucumber.yml
create script/cucumber
chmod script/cucumber
create features/step_definitions
create features/step_definitions/web_steps.rb
create features/support
create features/support/paths.rb
create features/support/selectors.rb
create features/support/env.rb
exist lib/tasks
create lib/tasks/cucumber.rake
gsub config/database.yml
gsub config/database.yml
force config/database.yml
Could somebody tell me what am I doing wrong?
Thanks in advance!
After some searching in the internet I'm able to answer to this question by myself ;)
It turned out that everything is ok with this Cucumber installation. Currently there is a change in 'cucumber-rails' gem and web_steps.rb (and others) file isn't generated anymore. About the reason you can read here: 'The training wheels came off'
The problem has occurred because I learn Ruby on Rails from "Rails 3 in Action" book in which old behavior of 'cucumber-rails' gem is described.
Related
When I make a new Rails project, add gem 'reactive-record', and run rails server, I get a Bundler error: There was an error while trying to load the gem 'reactive-record'. (Bundler::GemRequireError).
What gives? I have Rails 4.2.5 and Ruby 2.1.2.
Cheers!
The latest version of the generator should work very well with the help of Mitch. We collaborated together to make a generator in order to simplify greatly the installation of react.rb and reactive-record.
You should be able to get up and running by adding to your gem file :
gem 'reactive_rails_generator'
Then do a bundle install
and finally :
rails g reactrb:install --all
bundle update
Will install you reactrb, reactive-record and reactive-router.
Once installed, you can create components by doing :
rails g reactrb:component Home::Show
I worked around the problem like this:
Set rvm to use Ruby 2.2.2 and Rails 4.2.4.
Download https://codeload.github.com/catprintlabs/reactive-record/zip/master
Edited reactive-record-master/Gemfile to read:
gem 'reactive-ruby'
gem 'opal'
gem 'opal-browser'
gem 'react-rails'
cd reactive-record-master/spec/test_app
bundle install
rails server
This seemed to work.
Then, I made a new Rails 4.2.4 project. Adding only gem 'reactive-record' to the Gemfile resulted in the same error. Then I made the Gemfile read:
gem 'reactive-ruby'
gem 'opal'
gem 'opal-browser'
gem 'react-rails'
gem 'reactive-record'
And voila, rails server works!
Hope this helps someone else.
Hurray! Rails 4 is here...
Now, how do I create a 3.2.13 app since
rails new my app
installs rails '4.0.0.rc1'
Also, I already have rails gem 3.2.13 installed
you should do:
gem install 'rails' -v '3.2.13'
You should use a clean gemset, if you are using rvm, you can try:
rvm gemset create <name>
rvm gemset use <name>
Now you have a clean gemset, it's time to install rails,
gem install rails -v '3.2.13'
and then create a rails app,
rails new app_name
rails _3.2.13_ new app
(I'm using rbenv)
You can call specific gem (applies to any gem as far as I know) with following syntax:
rails _3.2.13_ -v
After this, it’s matter of using bundle exec rails instead of just rails, inside the application.
This is mine Gemfile
gem 'haml'
group :development do
gem 'hpricot'
gem 'ruby_parser'
end
I then executed the following statements in a terminal/command window:
bundle install
rails generate devise:views users -e haml
or
rails generate devise:views users -t = haml
But creating devise views in erb. how to fix this issue?
Even simpler solution.
I have erb2haml installed in the development section of my Gemfile, so I just run:
rails generate devise:views
rake haml:erb2haml
# or
rake haml:replace_erbs # outdated
Done!
I have to do this
rails generate devise:views
gem "html2haml"
bundle install
for file in app/views/devise/**/*.erb; do html2haml -e $file ${file%erb}haml && rm $file; done
and now it is perfect.
Also see the devise wiki
Have a quick look here. It gives in details explanation itself from devise documentation
How-To:-Create-Haml-and-Slim-Views
seems that the option to indicate which template engine to use is missing (version 3.0.0). An issue has been open for this. https://github.com/plataformatec/devise/issues/2455
its simply erb to haml conversion case. you may use any sort of haml converter. Like this one
http://htmltohaml.com/
Im not going to start by saying i'm a newbie etc. Jokes, been learning Rails for nearly month using Lynda.com. I use Mac, Mac OS X Lion 10.7.
I am trying to intall Paperclip Gem but i can't seem to figure out what i'm doing wrong.
I followed the instructions on https://github.com/thoughtbot/paperclip/wiki/Installation
I added this line to my config/environment.rb
config.gem 'paperclip', :source => 'http://rubygems.org'
and i then tried to run
rake gems:install
I get an error message:
(in /Users/fred/Ruby/food)
rake aborted!
undefined local variable or method `config' for main:Object
/Users/fred/Ruby/food/Rakefile:4:in `require'
(See full trace by running task with --trace)
I then tried the following as an alternative when the above failed
script/plugin install git://github.com/thoughtbot/paperclip
I get the following error
-bash: script/plugin: No such file or directory
My question is how do install this gem? I have read a lot of other posts that say i should include gem 'paperclip', "~> 2.3" is this the same as what i did above?
Best to use bundler. Steps are
Install bundler: gem install bundler
Add to Gemfile: config.gem 'paperclip'
cd to where the Gemfile is and run: bundle install. This will install all the gems mentioned in the Gemfile
Ps. I assume that you are not using rvm. Also, you may need to prefix sudo to the command in step 1 above in case the command does not work for you due to a permission problem.
I am trying to use the koala gem per these instructions: https://github.com/arsduo/koala/wiki
I did a gem install koala. I see the gem in the list of installed gems.
The instructions say to add
require 'rubygems'
require 'koala'
It doesn't say where. I tried it to add the lines to the beginning of one of my controllers.
Then I also tried it in the initializer file:
C:\Documents and Settings\mtariq\blog\config\initializers\koala.rb
I always get the same error:
no such file to load -- koala
I installed the gem.. so what 'file' is it trying to load?
Any help would be appreciated. I know I must be doing something stupid but can't find any clues.
Mariam
Assuming you are running rails 3, just add the koala gem to your Gemfile, then run 'bundle install'. No need to require any library.
# Gemfile
gem 'koala'