From d0d012f66f9c8d1e476a079a88470f7a7dba18a3 Mon Sep 17 00:00:00 2001
From: Jeffrey Phillips Freeman <jeffrey.freeman@syncleus.com>
Date: Sun, 2 Oct 2016 06:53:46 -0400
Subject: [PATCH] Reformatted all files to match formatting standard.

---
 Rakefile                  | 59 ++++++++++++++++++++-------------------
 apex.gemspec              | 58 +++++++++++++++++++-------------------
 bin/apex                  | 36 ++++++++++++------------
 features/apex.feature     | 10 +++----
 features/support/env.rb   | 12 ++++----
 lib/apex.rb               |  2 +-
 lib/aprs/aprs_kiss.rb     |  2 +-
 lib/kiss/kiss_abstract.rb | 15 ++++------
 lib/kiss/kiss_serial.rb   |  2 +-
 test/tc_kiss.rb           |  2 +-
 10 files changed, 97 insertions(+), 101 deletions(-)

diff --git a/Rakefile b/Rakefile
index 12bacaf..96a90c5 100644
--- a/Rakefile
+++ b/Rakefile
@@ -1,28 +1,29 @@
 def dump_load_path
-  puts $LOAD_PATH.join("\n")
-  found = nil
-  $LOAD_PATH.each do |path|
-    if File.exists?(File.join(path,"rspec"))
-      puts "Found rspec in #{path}"
-      if File.exists?(File.join(path,"rspec","core"))
-        puts "Found core"
-        if File.exists?(File.join(path,"rspec","core","rake_task"))
-          puts "Found rake_task"
-          found = path
-        else
-          puts "!! no rake_task"
+    puts $LOAD_PATH.join("\n")
+    found = nil
+    $LOAD_PATH.each do |path|
+        if File.exists?(File.join(path, "rspec"))
+            puts "Found rspec in #{path}"
+            if File.exists?(File.join(path, "rspec", "core"))
+                puts "Found core"
+                if File.exists?(File.join(path, "rspec", "core", "rake_task"))
+                    puts "Found rake_task"
+                    found = path
+                else
+                    puts "!! no rake_task"
+                end
+            else
+                puts "!!! no core"
+            end
         end
-      else
-        puts "!!! no core"
-      end
     end
-  end
-  if found.nil?
-    puts "Didn't find rspec/core/rake_task anywhere"
-  else
-    puts "Found in #{path}"
-  end
+    if found.nil?
+        puts "Didn't find rspec/core/rake_task anywhere"
+    else
+        puts "Found in #{path}"
+    end
 end
+
 gem 'json', '~> 1.8.3'
 
 gem 'bundler', '~> 1.13'
@@ -44,23 +45,23 @@ Bundler::GemHelper.install_tasks
 
 
 Rake::TestTask.new do |t|
-  t.pattern = 'test/tc_*.rb'
+    t.pattern = 'test/tc_*.rb'
 end
 
 
 CUKE_RESULTS = 'results.html'
 CLEAN << CUKE_RESULTS
 Cucumber::Rake::Task.new(:features) do |t|
-  t.cucumber_opts = "features --format html -o #{CUKE_RESULTS} --format pretty --no-source -x"
-  t.fork = false
+    t.cucumber_opts = "features --format html -o #{CUKE_RESULTS} --format pretty --no-source -x"
+    t.fork = false
 end
 
 Rake::RDocTask.new do |rd|
-  
-  rd.main = "README.rdoc"
-  
-  rd.rdoc_files.include("README.rdoc","lib/**/*.rb","bin/**/*")
+
+    rd.main = "README.rdoc"
+
+    rd.rdoc_files.include("README.rdoc", "lib/**/*.rb", "bin/**/*")
 end
 
-task :default => [:test,:features]
+task :default => [:test, :features]
 
diff --git a/apex.gemspec b/apex.gemspec
index b2e0cc4..b4843ff 100644
--- a/apex.gemspec
+++ b/apex.gemspec
@@ -4,37 +4,37 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
 require 'apex'
 
 Gem::Specification.new do |spec|
-  spec.name          = 'apex'
-  spec.version       = Apex::VERSION
-  spec.authors       = ['Jeffrey Phillips Freeman']
-  spec.email         = ['jeffrey.freeman@syncleus.com']
+    spec.name = 'apex'
+    spec.version = Apex::VERSION
+    spec.authors = ['Jeffrey Phillips Freeman']
+    spec.email = ['jeffrey.freeman@syncleus.com']
 
-  spec.summary       = %q{Reference implementation for the APEX Radio protocol.}
-  spec.description   = %q{Reference implementation for the APEX Radio protocol.}
-  spec.homepage      = 'http://apexprotocol.com'
+    spec.summary = %q{Reference implementation for the APEX Radio protocol.}
+    spec.description = %q{Reference implementation for the APEX Radio protocol.}
+    spec.homepage = 'http://apexprotocol.com'
 
-  # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
-  # to allow pushing to a single host or delete this section to allow pushing to any host.
-  if spec.respond_to?(:metadata)
-    spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
-  else
-    raise 'RubyGems 2.0 or newer is required to protect against public gem pushes.'
-  end
+    # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
+    # to allow pushing to a single host or delete this section to allow pushing to any host.
+    if spec.respond_to?(:metadata)
+        spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
+    else
+        raise 'RubyGems 2.0 or newer is required to protect against public gem pushes.'
+    end
 
-  spec.files         = `git ls-files -z`.split("\x0").reject do |f|
-    f.match(%r{^(test|spec|features)/})
-  end
-  spec.bindir        = 'exe'
-  spec.executables   = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
-  spec.require_paths = ['lib']
+    spec.files = `git ls-files -z`.split("\x0").reject do |f|
+        f.match(%r{^(test|spec|features)/})
+    end
+    spec.bindir = 'exe'
+    spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
+    spec.require_paths = ['lib']
 
-  spec.add_development_dependency 'bundler'
-  spec.add_development_dependency 'rake'
-  spec.add_development_dependency 'rdoc'
-  spec.add_development_dependency 'aruba'
-  spec.add_dependency 'abstraction'
-  spec.add_dependency 'json'
-  spec.add_dependency 'serialport'
-  spec.add_dependency 'methadone'
-  spec.add_dependency 'colorize'
+    spec.add_development_dependency 'bundler'
+    spec.add_development_dependency 'rake'
+    spec.add_development_dependency 'rdoc'
+    spec.add_development_dependency 'aruba'
+    spec.add_dependency 'abstraction'
+    spec.add_dependency 'json'
+    spec.add_dependency 'serialport'
+    spec.add_dependency 'methadone'
+    spec.add_dependency 'colorize'
 end
diff --git a/bin/apex b/bin/apex
index 927b3c6..0930b96 100755
--- a/bin/apex
+++ b/bin/apex
@@ -5,29 +5,29 @@ require 'methadone'
 require_relative '../lib/apex'
 
 class App
-  include Methadone::Main
-  include Methadone::CLILogging
+    include Methadone::Main
+    include Methadone::CLILogging
 
-  main do |needed, maybe|
-    puts options[:switch]
-    puts options[:flag]
-    Apex::main
-  end
+    main do |needed, maybe|
+        puts options[:switch]
+        puts options[:flag]
+        Apex::main
+    end
 
-  description "APEX reference implementation for the APEX protocol."
-  version Apex::VERSION
+    description "APEX reference implementation for the APEX protocol."
+    version Apex::VERSION
 
-  # Proxy to an OptionParser instance's on method
-  on("--[no]-switch", "Toggles the switch")
-  on("--flag VALUE", "Sets the flag.")
+    # Proxy to an OptionParser instance's on method
+    on("--[no]-switch", "Toggles the switch")
+    on("--flag VALUE", "Sets the flag.")
 
-  arg :needed
-  arg :maybe, :optional
+    arg :needed
+    arg :maybe, :optional
 
-  defaults_from_env_var 'SOME_VAR'
-  defaults_from_config_file '.apex.rc'
+    defaults_from_env_var 'SOME_VAR'
+    defaults_from_config_file '.apex.rc'
 
-  use_log_level_option :toggle_debug_on_signal => 'USR1'
+    use_log_level_option :toggle_debug_on_signal => 'USR1'
 
-  go!
+    go!
 end
diff --git a/features/apex.feature b/features/apex.feature
index 7ba029b..6b0e99e 100644
--- a/features/apex.feature
+++ b/features/apex.feature
@@ -9,10 +9,10 @@ Feature: My bootstrapped app kinda works
     And the banner should be present
     And the banner should document that this app takes options
     And the following options should be documented:
-      |--version|
-      |--[no]-switch|
-      |--flag|
+      | --version     |
+      | --[no]-switch |
+      | --flag        |
     And the banner should document that this app's arguments are:
-      |needed|which is required|
-      |maybe|which is optional|
+      | needed | which is required |
+      | maybe  | which is optional |
     And there should be a one line summary of what the app does
diff --git a/features/support/env.rb b/features/support/env.rb
index f7495c8..83f4316 100644
--- a/features/support/env.rb
+++ b/features/support/env.rb
@@ -2,15 +2,15 @@ require 'aruba/cucumber'
 require 'methadone/cucumber'
 
 ENV['PATH'] = "#{File.expand_path(File.dirname(__FILE__) + '/../../bin')}#{File::PATH_SEPARATOR}#{ENV['PATH']}"
-LIB_DIR = File.join(File.expand_path(File.dirname(__FILE__)),'..','..','lib')
+LIB_DIR = File.join(File.expand_path(File.dirname(__FILE__)), '..', '..', 'lib')
 
 Before do
-  # Using "announce" causes massive warnings on 1.9.2
-  @puts = true
-  @original_rubylib = ENV['RUBYLIB']
-  ENV['RUBYLIB'] = LIB_DIR + File::PATH_SEPARATOR + ENV['RUBYLIB'].to_s
+    # Using "announce" causes massive warnings on 1.9.2
+    @puts = true
+    @original_rubylib = ENV['RUBYLIB']
+    ENV['RUBYLIB'] = LIB_DIR + File::PATH_SEPARATOR + ENV['RUBYLIB'].to_s
 end
 
 After do
-  ENV['RUBYLIB'] = @original_rubylib
+    ENV['RUBYLIB'] = @original_rubylib
 end
diff --git a/lib/apex.rb b/lib/apex.rb
index 957c087..a05e577 100644
--- a/lib/apex.rb
+++ b/lib/apex.rb
@@ -3,7 +3,7 @@ require 'aprs/aprs_kiss'
 
 module Apex
     VERSION = "0.0.1"
-    
+
     def self.main
         kiss = Kiss::KissSerial.new('/dev/ttyUSB1', 9600)
         aprs_kiss = Aprs::AprsKiss.new(kiss)
diff --git a/lib/aprs/aprs_kiss.rb b/lib/aprs/aprs_kiss.rb
index aa68c6b..caad0ef 100644
--- a/lib/aprs/aprs_kiss.rb
+++ b/lib/aprs/aprs_kiss.rb
@@ -110,7 +110,7 @@ module Aprs
             enc_ssid = (callsign[:ssid] << 1) | 0x60
 
             if call_sign.include? '*'
-                call_sign.gsub!(/\*/,'')
+                call_sign.gsub!(/\*/, '')
                 enc_ssid |= 0x80
             end
 
diff --git a/lib/kiss/kiss_abstract.rb b/lib/kiss/kiss_abstract.rb
index 2768664..b4112e4 100644
--- a/lib/kiss/kiss_abstract.rb
+++ b/lib/kiss/kiss_abstract.rb
@@ -54,12 +54,7 @@ module Kiss
 
         protected
         def write_setting(command, value)
-            write_interface(
-                [FEND] +
-                [command] +
-                escape_special_codes(value) +
-                [FEND]
-            )
+            write_interface([FEND] + [command] + escape_special_codes(value) + [FEND])
         end
 
         private
@@ -81,19 +76,19 @@ module Kiss
                 # No FEND in frame
                 if len_fend == 1
                     read_buffer += split_data[0]
-                # Single FEND in frame
+                    # Single FEND in frame
                 elsif len_fend == 2
                     # Closing FEND found
                     if split_data[0]
                         # Partial frame continued, otherwise drop
                         new_frames << read_buffer + split_data[0]
                         read_buffer = []
-                    # Opening FEND found
+                        # Opening FEND found
                     else
                         new_frames << read_buffer
                         read_buffer = split_data[1]
                     end
-                # At least one complete frame received
+                    # At least one complete frame received
                 elsif len_fend >= 3
                     (0...len_fend - 1).each do |i|
                         read_buffer_tmp = read_buffer + split_data[i]
@@ -109,7 +104,7 @@ module Kiss
                 # Get anymore data that is waiting
                 read_data = read_interface
             end
-            
+
             new_frames.each do |new_frame|
                 if new_frame.length > 0 and new_frame[0] == 0
                     if @strip_df_start
diff --git a/lib/kiss/kiss_serial.rb b/lib/kiss/kiss_serial.rb
index 95384e6..5a90d70 100644
--- a/lib/kiss/kiss_serial.rb
+++ b/lib/kiss/kiss_serial.rb
@@ -59,7 +59,7 @@ module Kiss
             # Previous verious defaulted to Xastir-friendly configs. Unfortunately
             # those don't work with Bluetooth TNCs, so we're reverting to None.
             if kwargs
-                kwargs.each do |name,value|
+                kwargs.each do |name, value|
                     write_setting(name, value)
                 end
             end
diff --git a/test/tc_kiss.rb b/test/tc_kiss.rb
index 3a27e2d..4cf33bd 100644
--- a/test/tc_kiss.rb
+++ b/test/tc_kiss.rb
@@ -11,7 +11,7 @@ module Kiss
                      69, 50, 42, 44, 113, 65, 82, 44, 75, 70, 54, 70, 73, 82, 45, 49, 48, 58, 96, 49, 55, 69, 108, 35,
                      88, 45, 47, 107, 103, 54, 119, 116, 102, 64, 103, 111, 115, 115, 101, 108, 105, 110, 102, 97, 109,
                      105, 108, 121, 46, 99, 111, 109]
-    
+
     class TestKiss < Test::Unit::TestCase
         def test_read
             kiss_mock = KissMock.new
-- 
GitLab