yaesu 1.0.3.beta → 1.1.0.beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3ab00e14099e0e558dce2b7a8584cff3f54b93cf03ff69f8dab50e18c51dbb2f
4
- data.tar.gz: 207ef0ce0e6ba9ed1017815e6e4d5dcc233fbf087df3164cef33576c723fc64c
3
+ metadata.gz: 15bb33323a96fda9a06ac63f7bbe1b288fd5055ce53894ed247ad8fdb061de64
4
+ data.tar.gz: 2b445c2e495682d9bfe5a2978bfce11761c5ff70892bdeb3253ba8a7022036e0
5
5
  SHA512:
6
- metadata.gz: d89e616f9fc5f15019956dcb2550623e9af79394201f788fc7a0af1399edb3d2af737d5efcd3a9e1f66bc21d0ddb74d10c32c9a7f7d69994a76c648f601c7e9c
7
- data.tar.gz: be12ce66a27ef201107244a99ee81b4a53b481e5f525857caca53405210c5b96896300532c4521d7b7579fd126da51c685f900fb4fb1f8858354057ab362c551
6
+ metadata.gz: f50bb0451ab06dc6dab31e7108903da61186463ee32b425ccb2fdb27aa0445b89bd5eb42e77c103dff7e6f714d2dc68000bb60ae5469d50c84fd84ac0aa34984
7
+ data.tar.gz: e72ec71eab45f57e12604421c35da1f15966546da696fa475bfafe6310efb45330d893c0090c972f104d70c8f75d6797a884e03ccb4ef1fffa3b1ba0bf2bb02e
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- yaesu (1.0.1.beta)
4
+ yaesu (1.0.3.beta)
5
5
  msgpack
6
6
  ohm
7
7
  ost
data/bin/console CHANGED
@@ -13,7 +13,13 @@ require "yaesu"
13
13
 
14
14
  #require "irb"
15
15
  #IRB.start(__FILE__)
16
- Yaesu.listen on: "so.fa.dog" do |msg|
16
+
17
+ Yaesu.configure do |config|
18
+ config.name = "poop"
19
+ config.channel ="delane.burke.me.com"
20
+ end
21
+
22
+ Yaesu.listen! do |msg|
17
23
  puts msg
18
24
  end
19
25
 
data/lib/yaesu.rb CHANGED
@@ -13,20 +13,40 @@ require 'fileutils'
13
13
  require_relative "yaesu/version"
14
14
 
15
15
  module Yaesu
16
+
17
+ def self.configuration
18
+ @configuration ||= OpenStruct.new(
19
+ {
20
+ channel: "yaesu.local",
21
+ name: "base",
22
+ data_dir: "./.data"
23
+ }
24
+ )
25
+ end
26
+
27
+ def self.configure
28
+ yield(configuration)
29
+ end
30
+
16
31
  class Error < StandardError; end
17
32
  def self.transmit on:, event:, data:
18
33
  Ost[on] << {uid: UUID.new.generate,event:event, data: data}.to_msgpack
19
34
  end
35
+
36
+ def self.listen!
37
+ self.listen name:Yaesu.configuration.name, on: Yaesu.configuration.channel
38
+ end
39
+
20
40
  def self.listen name:, on:
21
41
 
22
- FileUtils.mkdir_p(".data/#{name}") unless Dir.exists? ".data"
42
+ FileUtils.mkdir_p("#{Yaesu.configuration.data_dir}/#{name}") unless Dir.exists? ".data"
23
43
 
24
- puts "listening on #{on}...."
44
+ puts "#{name} is listening on #{on} -> Ok!"
25
45
 
26
46
  begin
27
47
  loop do
28
48
  Ost[on].items.each do |data|
29
- SDBM.open "./.data/#{name}" do |db|
49
+ SDBM.open "#{Yaesu.configuration.data_dir}/#{name}" do |db|
30
50
  o = MessagePack.unpack(data)
31
51
  message =OpenStruct.new(o)
32
52
  next if db.has_key? message.uid
@@ -41,7 +61,7 @@ module Yaesu
41
61
  sleep 0.200
42
62
  end
43
63
  rescue Interrupt => e
44
- puts "listening on #{on}....finished!"
64
+ puts "#{name} stopped listening on #{on} -> Ok!"
45
65
  end
46
66
  end
47
67
  end
data/lib/yaesu/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Yaesu
4
- VERSION = "1.0.3.beta"
4
+ VERSION = "1.1.0.beta"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yaesu
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3.beta
4
+ version: 1.1.0.beta
5
5
  platform: ruby
6
6
  authors:
7
7
  - Coco Coder