Module: Wiki2GoEditor::Install
- Defined in:
- lib/Wiki2GoEditor/Install/editor.rb
Class Method Summary collapse
Class Method Details
.editor(args, &block) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/Wiki2GoEditor/Install/editor.rb', line 10 def self.editor(args,&block) opts = OptionParser.new directory = nil opts.on("-d",'--directory dir',"default = .",String) { |val| directory = File.(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 |
.install_editor_in(directory, &block) ⇒ Object
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/Wiki2GoEditor/Install/editor.rb', line 28 def self.install_editor_in(directory,&block) source = File.(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 |