Commit d0d012f6 authored by Jeffrey Phillips Freeman's avatar Jeffrey Phillips Freeman 💥
Browse files

Reformatted all files to match formatting standard.

parent d4cce00c
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]
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......@@ -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)
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment