Confused about how to install Rails plugins - ruby-on-rails

I found an example here showing how to install a Rails plugin. Their example shows this:
./script/plugin install calendar_helper
This won't work for me because, confusingly, I don't have anything called plugin in my script directory. All I have is rails:
$ ls script/
rails
So Rails doesn't come with the script you need to install plugins? You need a plugin to install plugins? That doesn't seem very likely. Is something wrong with my Rails project?

You're probably on Rails 3. Replace ./script/plugin with rails plugin.
rails plugin install calendar_helper
But the other problem is plugins, unlike gems, need to be installed with a full path. This was also true in Rails 2.x.
rails plugin install https://github.com/topfunky/calendar_helper.git

You should first input text like gem 'calendar_helper' in your Gemfile, and then run bundle install for rails 3.0

Related

Rails version stuck at 2.3.5 how to update to 3.x

Hi there thanks for looking into this.
after a clean install of Linux ubuntu 10.10 i tried to re-install rails.
after doing sudo gem install rails, I can see I am returned version 3.2.3 of rails
But after generating a new project i couldn't find my gemfile so i tried ruby -v which returns 2.3.4 wich is odd since I know I got the latest.
Also when trying sudo gem update --system I get an error because I might override system files. any solution here?
I'd recommend using rvm to manage your ruby sets -- as well as defining gemsets for each project that will allow you to make sure each project has just the gems it needs.
Here's a link to the rvm installation instructions (they should work with ubuntu):
https://rvm.io/rvm/install/
Here's some info on basic use of gemsets with rvm:
https://rvm.io/gemsets/basics/
Also, when using rails 3+, you should make a practice of typing bundle exec rails -v -- that way you'll use the gems defined for the project you're in.
Can you try typing bundle exec rails -v and letting us know what you see?

rails 3 and acts-as-readable

Does the acts-as-readable plugin work for rails 3? The instructions at https://github.com/mbleigh/acts-as-readable results in Plugin not found: ["http://svn.intridea.com/svn/public/acts_as_readable"]
Downloading the source from github and sticking it in vendor/plugin doesn't seem to work, I get: Could not find generator acts_as_readable_migration.
I am doing something wrong or should I look elsewhere?
I forked the plugin to my GitHub account and updated its generators to work with Rails 3, which can be found at https://github.com/tjackiw/acts-as-readable.
After you install it
rails plugin install git://github.com/tjackiw/acts-as-readable.git
then you can do
rails generate acts_as_readable_migration
Have fun!
try script/rails plugin install git://github.com/mbleigh/acts-as-readable.git to install it from that git repo.
Looks like it will install, but uncertain if it "works" given it hasn't been updated since 2008

Rails 3 - How to install awesome_nested_set

I want to install awesome_nested_set in my Rails 3 app. This is a plugin, versus a gem. I've installed gems but never a plugin.
The awesome_nested_set is here: https://github.com/collectiveidea/awesome_nested_set
But that appears to not be Rails 3 friendly, according to several reported issues.
There is a Rails 3 friendly fork here: https://github.com/FreakyDazio/awesome_nested_set
But I'm not sure how to install this? How do I install this plugin in my Rails 3 app?
Thanks
In Rails 3, install a plugin via:
rails plugin install <path to plugin>
So, for this plugin:
rails plugin install git://github.com/FreakyDazio/awesome_nested_set.git
Using just rails plugin will give you additional information.
In Rails 3, the script/foo scripts have been replaced by calling rails directly, so in your case, to install the FreakyDazio fork of awesome_nested_set:
rails plugin install git://github.com/FreakyDazio/awesome_nested_set.git
Rails by default looks in vendor/plugins (which is where rails plugin install will install to) for plugins to load (at which time, the plugin's init.rb file will be run). Here is an article about plugins in Rails 3. You might want to read about the Rails initialization process as well.

Problem installing LESS for Ruby on Rails - script/plugin: command not found

I am trying to install LESS in a Ruby on Rails project. I am able to run the gem successfully, but when I try to install the plugin for LESS, I get an error. Here's what shows in the terminal:
MacBook:benji jesse$ sudo gem install less
Successfully installed less-1.2.21
1 gem installed
Installing ri documentation for less-1.2.21...
Installing RDoc documentation for less-1.2.21...
MacBook:benji jesse$ sudo script/plugin install git://github.com/cloudhead/more.git
sudo: script/plugin: command not found
I am a .NET developer trying to learn Ruby on Rails (on a Mac), so I am new to all this stuff.
My question's are:
Is the script/plugin command a standard command?
What does it do?
Where can I learn more about this command?
Why does it say command
can't be found?
Is the script/plugin command a standard command?
It is in rails 2, it has changed in rails 3:
rails plugin
# or
script/rails plugin
What does it do?
installs the given plugin into the RAILS_ROOT/vendor/plugin, but you should look if there is a gem version of the plugin, than you can add a gem dependency to this gem.
Where can I learn more about this command?
run the command without any parameters
Why does it say command can't be found?
try ls script/ and see if the file exists.
You have to be in the application directory. Say you created your rails app in the folder development/rails_app. You must execute the script/plugin command from there (and you don't need super user permissions for that):
cd development/rails_app
script/plugin install git://github.com/cloudhead/more.git
The plugin installation will apply only to the current rails application (in this case, rails_app). So if you create another application, you must run the script/plugin command again.

Plugins not getting properly installed

i am having this annoying problem when deploying rails plugins. I can install them by downloading the source and putting it in the vendor/plugins directory, But i want to do it with the easy command line. I am trying to install the will_paginate plugin.
tried this command ruby script/plugin install git://github.com/mislav/will_paginate.git
that doesn't work, i tried this one as well ruby script/plugin install http://github.com/mislav/will_paginate.git
the problem i am getting is, There is no error while installing the plugin from command line, but rather there is an empty folder created inside vendor/plugins directory by the name of will_paginate, And the folder is empty. Any solutions for this?
thanks.
It sounds like you don't have git installed. Are you using Windows? If so, you'll have to download and configure a command-line git client.
If you do have git installed and configured correctly, alternatively, from your root rails directory you could try:
git clone git://github.com/mislav/will_paginate.git vendor/plugins/will_paginate
ruby script/plugin install git://github.com/mislav/will_paginate.git
That should work for you. For reference, here is the blog post from github. According to that post, this was supported beginning in Rails 2.0.2, so you'll need to be using at least that version of Rails and have git installed locally.

Resources