Sha256: 942655c71cbbaa49ad214fce684ee87ec31fe08315d283b6faa23a84761eabbe
Contents?: true
Size: 1.1 KB
Versions: 1
Compression:
Stored size: 1.1 KB
Contents
# -*- coding: ISO-8859-1 -*- require 'optparse' require 'fileutils' module Wiki2GoEditor module Install def self.editor(args,&block) opts = OptionParser.new directory = nil opts.on("-d",'--directory dir',"default = .",String) { |val| directory = File.expand_path(val) } opts.on_tail("-h", "--help", "Show this message") do yield opts.to_s if block_given? end opts.parse(args) if directory.nil? then yield opts.to_s if block_given? else install_editor_in(directory,&block) end end def self.install_editor_in(directory,&block) source = File.expand_path(File.join(File.dirname(__FILE__),'..','..','..','fckeditor')) dest = File.join(directory,'site') raise ArgumentError,'The directory does not contain a site subdirectory',caller unless File.exist?(dest) begin FileUtils::ln_s(source,dest) rescue NotImplementedError => err # Linking not implemented on Windows FileUtils::cp_r(source,dest) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
Wiki2GoEditor-1.0.0 | lib/Wiki2GoEditor/Install/editor.rb |