Module: Rails::Generators::Actions

Defined in:
lib/plugger.rb

Instance Method Summary collapse

Instance Method Details

#plugin(name, options) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/plugger.rb', line 14

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
      `bundle exec plugger install #{options[:svn] || options[:git]} --force`
    end
  else
    log "! no git or svn provided for #{name}. Skipping..."
  end
end