Sha256: 01ed9b567afe83827f7b73a2209e6b9d1ae74265aedad4a5edb4960919c0893f

Contents?: true

Size: 1.43 KB

Versions: 7

Compression:

Stored size: 1.43 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
    if File.exists? editor_script = @rails_root + "/script/editor"
      File.chmod(0755,editor_script) 
    end
    puts "******************************************************"
    puts "** Rails Editor Installed, ./script/editor to start **"
    puts "******************************************************"
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
RailsEditor-0.0.23 lib/rails-editor.rb
RailsEditor-0.0.22 lib/rails-editor.rb
RailsEditor-0.0.24 lib/rails-editor.rb
RailsEditor-0.0.25 lib/rails-editor.rb
RailsEditor-0.0.26 lib/rails-editor.rb
RailsEditor-0.0.27 lib/rails-editor.rb
RailsEditor-0.0.28 lib/rails-editor.rb