Method: Red::Executable#build_red_plugin_for_rails

Defined in:
lib/red/executable.rb

#build_red_plugin_for_railsObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/red/executable.rb', line 3

def build_red_plugin_for_rails
  unless File.exists?('vendor/plugins')
    puts "Directory vendor/plugins does not exist."
    exit
  end
  
  begin
    Dir.mkdir('vendor/plugins/red') unless File.exists?('vendor/plugins/red')
  rescue SystemCallError
    puts "Unable to create directory in vendor/plugins"
    exit
  end
  
  File.open('vendor/plugins/red/init.rb', 'w') { |f| f.write("require 'rubygems'\nrequire 'red'\n\n# Red is not yet supported for Rails projects.\n")} #Red.for_rails(binding)\n") }
  
  puts "Red plugin added to project."
  exit
end