Sha256: c403f378e7e725540dd204a1976b241e91d6eb169d94728274689e49900ae4a0

Contents?: true

Size: 1.12 KB

Versions: 1

Compression:

Stored size: 1.12 KB

Contents

EDITOR_LIB_HOME = File.expand_path(File.dirname(__FILE__) + "/../")
require "rubygems"
require "rake/gempackagetask"
class RailsEditor
  attr_accessor :rails_root
  def initialize(args = {:rails_root => ENV['PWD']})
    @rails_root = args[:rails_root]
  end

  def create
    rails_home = EDITOR_LIB_HOME + "/rails"
    files = FileList[rails_home + "/**/*"].to_a 
    files += FileList[rails_home + "/.vim/**/*"]
    files += [rails_home + "/.vimrc",rails_home + "/config/.screenrc.code.erb"]
    files.to_a.each do |editor_file|
      save_dir = @rails_root + File.dirname(editor_file.split(rails_home)[1])
      if FileTest.directory?(editor_file)
        if not File.exists?(save_dir)
          puts 'Dir.mkdir("' + save_dir + '")'
          Dir.mkdir(save_dir)
        end
        next
      end
      if not File.exists?(save_dir) or not FileTest.directory?(save_dir)
          puts "Dir.mkdir(" + save_dir + ") "
          Dir.mkdir(save_dir) 
      end
      puts "File.cp(" + editor_file + "," + save_dir  + "/" + File.basename(editor_file) +  ") "
      File.cp(editor_file,save_dir  + "/" + File.basename(editor_file)) 
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
RailsEditor-0.0.21 lib/rails-editor.rb