Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 35 lines (32 sloc) 1.192 kb
d6760a5 @grosser comment on whats going on
authored
1 # Fix Rails 2 and Rails 3.0 script files. Rails 3.1 works out of the box
e57967f @grosser rails3 support
authored
2 rails_2 = <<-EOF
526fd4d @grosser add install hook and use it in specs
authored
3 #!/usr/bin/env ruby
4 require File.dirname(__FILE__) + '/../config/boot'
f6f201c @grosser put everything into its proper file/folder
authored
5 $LOAD_PATH << 'vendor/plugins/tracked_plugins/lib'
3d08c57 @grosser rename
authored
6 require 'vendor/plugins/tracked_plugins/lib/tracked_plugins'
526fd4d @grosser add install hook and use it in specs
authored
7 EOF
8
e57967f @grosser rails3 support
authored
9 rails_3 = "$LOAD_PATH.unshift( File.expand_path('../../vendor/plugins/tracked_plugins/lib', __FILE__) )\n"
10
11 if File.exist?('script/plugin') # rails 2
12 # install script/plugin hook
13 File.open('script/plugin', 'w'){|f| f.write rails_2 }
14 elsif File.exist?('script/rails') # rails 3
15 # install script/rails hook
16 lines = File.readlines('script/rails').map do |line|
17 if line.include?('plugins/tracked_plugins')
18 nil # remove old installation
19 elsif line.strip == 'require BOOT_PATH'
20 [line, rails_3] # add hook after this line
21 else
22 line
23 end
24 end
25 File.open('script/rails','w'){|f| f.write lines.compact.flatten.join }
526fd4d @grosser add install hook and use it in specs
authored
26 else
e57967f @grosser rails3 support
authored
27 # instruct user to DIY
28 puts "could not find script/plugin or script/rails, put this in yourself!!!"
29 puts "Rails 2: put this into script/plugin"
30 puts rails_2
31 puts ""
32 puts "Rails 3: add after 'require BOOT_PATH' in script/rails"
33 puts rails_3
d6760a5 @grosser comment on whats going on
authored
34 end
Something went wrong with that request. Please try again.