bin/caramelize in caramelize-0.4.0 vs bin/caramelize in caramelize-1.0.0

- old
+ new

@@ -4,11 +4,11 @@ require 'commander/import' # :name is optional, otherwise uses the basename of this executable program :name, 'caramelize' program :version, Caramelize::VERSION -program :description, 'TODO' +program :description, 'With Caramelize you can migrate any wiki to git-based Gollum wiki repositories.' program :help, 'Author', 'Daniel Senff <public@danielsenff.de>' default_command :run global_option '--verbose' @@ -23,11 +23,11 @@ c.action do |args, options| target_file ||= (options.config || 'caramel.rb') options.default({ config: 'caramel.rb' }) FileUtils.cp(File.dirname(__FILE__) + '/../lib/caramelize/caramel.rb', options.config) - say "Created new configuration file: #{optinos.config}" + say "Created new configuration file: #{options.config}" end end alias_command :create, :new command :run do |c| @@ -37,15 +37,22 @@ c.option '--config STRING', String, 'The config file (default: caramel.rb)' c.example 'Run transfer for "caramel.rb"', 'caramelize run' c.example 'Run transfer for "config.rb"', 'caramelize run --config config.rb' c.action do |args, options| time_start = Time.now - options.default({ config: 'caramel.rb' }) - puts options.inspect + options.default({ config: 'caramel.rb', target: 'wiki-export' }) instance_eval(File.read(options.config)) - wiki_options = input_wiki.options.merge(verbose: options.verbose) + target = options.target + + if File.exists?(target) + answer = agree("#{target} already exists. Overwrite with fresh repository?") + FileUtils.rm_rf(target) if answer + end + + wiki_options = input_wiki.options.merge(verbose: options.verbose, + target: options.target) Caramelize::ContentTransferer.new(input_wiki, wiki_options).execute say "Time required: #{Time.now - time_start} s" end end