Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 2926

Show
Ignore:
Timestamp:
11/07/05 18:09:31 (3 years ago)
Author:
minam
Message:

Add 'add_new_scripts' rake task for adding new rails scripts to script/*

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/railties/CHANGELOG

    r2922 r2926  
    11*SVN* 
     2 
     3* Add 'add_new_scripts' rake task for adding new rails scripts to script/* [Jamis Buck] 
    24 
    35* Remove bogus hyphen from script/process/reaper calls to 'ps'.  #2767 [anonymous] 
  • trunk/railties/lib/tasks/framework.rake

    r2907 r2926  
    5151  rm_rf "vendor/rails" 
    5252end 
     53 
     54desc "Add new scripts to the application script/ directory" 
     55task :add_new_scripts do 
     56  local_base = "script" 
     57  edge_base  = "#{File.dirname(__FILE__)}/../../bin" 
     58 
     59  local = Dir["#{local_base}/**/*"].reject { |path| File.directory?(path) } 
     60  edge  = Dir["#{edge_base}/**/*"].reject { |path| File.directory?(path) } 
     61   
     62  edge.each do |script| 
     63    base_name = script[(edge_base.length+1)..-1] 
     64    next if base_name == "rails" 
     65    next if local.detect { |path| base_name == path[(local_base.length+1)..-1] } 
     66    if !File.directory?("#{local_base}/#{File.dirname(base_name)}") 
     67      mkdir_p "#{local_base}/#{File.dirname(base_name)}" 
     68    end 
     69    install script, "#{local_base}/#{base_name}", :mode => 0655 
     70  end 
     71end