bin/expandsync in expandsync-0.1.3 vs bin/expandsync in expandsync-0.2.0

- old
+ new

@@ -1,22 +1,50 @@ #!/usr/bin/env ruby - -require 'csv' +# Encoding: utf-8 +#-------------------------------------------------------------------- +# ExpandSync +# +# Synchronizes text expansion snippets between aText and +# TextExpander Touch +# +# Copyright (c) 2014 +# Aaron Bach <bachya1208@gmail.com> +# +# Permission is hereby granted, free of charge, to any person +# obtaining a copy of this software and associated documentation +# files (the "Software"), to deal in the Software without +# restriction, including without limitation the rights to use, +# copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following +# conditions: +# +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. +#-------------------------------------------------------------------- +require 'cliutils' require 'expandsync' -require 'fileutils' require 'methadone' -require 'nokogiri' require 'optparse' class App + include CLIUtils::Messenging include Methadone::Main - include Methadone::CLILogging main do |atext_filepath| begin - atext = AText.new(atext_filepath, options[:a]) - textexpander = TextExpander.new + atext = ExpandSync::AText.new(atext_filepath, options[:a]) + textexpander = ExpandSync::TextExpander.new # Create file content (CSV for aText, XML for TextExpander) # that contains the correct data: # 1. aText CSV should contain any new TextExpander snippets. # 2. TextExpander XML should contain original snippets *and* @@ -34,19 +62,19 @@ textexpander.save # This has to be here so that my Cucumber Aruba tests work. Don't ask why. leak_exceptions(true) rescue StandardError => e - ExpandSync::CLIMessage.error(e, false) + messenger.error(e.to_s) exit!(1) end end description ExpandSync::DESCRIPTION version ExpandSync::VERSION # Flags & Switches - on('-a FILEPATH', "Output location for aText rules (defaults to ~/#{ AText::OUTPUT_FILENAME })") + on('-a FILEPATH', "Output location for aText rules (defaults to ~/#{ ExpandSync::AText::OUTPUT_FILENAME })") on('-n', 'Disable backing up of Settings.textexpander (RUN AT YOUR OWN RISK!)') on('-v', '--verbose', 'Turn on verbose output') # Arguments arg :atext_filepath, 'The filepath to a CSV file exported from aText'