instance method plugin

Ruby on Rails 3.2.22.5

Since v3.0.20 Last seen in v3.2.22.5

Available in: v3.0.20 v3.1.12 v3.2.22.5

Signature

plugin(name, options)

Install a plugin. You must provide either a Subversion url or Git url.

For a Git-hosted plugin, you can specify a branch and whether it should be added as a submodule instead of cloned.

For a Subversion-hosted plugin you can specify a revision.

Examples

plugin 'restful-authentication', :git => 'git://github.com/technoweenie/restful-authentication.git'
plugin 'restful-authentication', :git => 'git://github.com/technoweenie/restful-authentication.git', :branch => 'stable'
plugin 'restful-authentication', :git => 'git://github.com/technoweenie/restful-authentication.git', :submodule => true
plugin 'restful-authentication', :svn => 'svn://svnhub.com/technoweenie/restful-authentication/trunk'
plugin 'restful-authentication', :svn => 'svn://svnhub.com/technoweenie/restful-authentication/trunk', :revision => 1234

Parameters

name req
options req
Source
# File railties/lib/rails/generators/actions.rb, line 24
      def plugin(name, options)
        log :plugin, name

        if options[:git] && options[:submodule]
          options[:git] = "-b #{options[:branch]} #{options[:git]}" if options[:branch]
          in_root do
            run "git submodule add #{options[:git]} vendor/plugins/#{name}", :verbose => false
          end
        elsif options[:git] || options[:svn]
          options[:git] = "-b #{options[:branch]} #{options[:git]}"   if options[:branch]
          options[:svn] = "-r #{options[:revision]} #{options[:svn]}" if options[:revision]
          in_root do
            run_ruby_script "script/rails plugin install #{options[:svn] || options[:git]}", :verbose => false
          end
        else
          log "! no git or svn provided for #{name}. Skipping..."
        end
      end

Defined in railties/lib/rails/generators/actions.rb line 24 · View on GitHub · Improve this page · Find usages on GitHub

Defined in Rails::Generators::Actions

Type at least 2 characters to search.

↑↓ navigate · open · esc close