mtik 4.0.1 → 4.0.2

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.
@@ -1,3 +1,14 @@
1
+ 2013-06-06 (06 JUN 2013) VERSION 4.0.2 Aaron D. Gifford (http://www.aarongifford.com)
2
+ Bart Braem (http://www.lalunerouge.net/)
3
+ * Merged Bart Braem's implementation of timeouts and bumped up the version. Thanks, Bart!
4
+ * Updated Rakefile to remove a bit of obsolescence
5
+
6
+ 2012-02-09 (09 FEB 2012) VERSION 4.0.1 Aaron D. Gifford (http://www.aarongifford.com)
7
+ * Added os_version to connections. Upon successful connect and login, the RouterOS
8
+ version is fetched and stored. This will allow future updates to better support
9
+ some commands that differ (like fetch) depending on which RouterOS version is
10
+ installed on the device.
11
+
1
12
  2011-03-25 (25 MAR 2011) VERSION 4.0.0 Aaron D. Gifford (http://www.aarongifford.com)
2
13
  * Per user suggestion, added a new optional cancel parameter to the MTik#command()
3
14
  method that will auto-cancel the supplied command after receiving the specified
@@ -13,6 +24,7 @@
13
24
  to symbol and fixed those, updated error messages to reflect state as a symbol,
14
25
  eliminated a few redundant key?() calls, and fixed a replycounter initialization
15
26
  typo (had set it to 1 instead of 0).
27
+
16
28
  2011-01-11 (11 JAN 2011) VERSION 3.1.2 Aaron D. Gifford (http://www.aarongifford.com)
17
29
  * Added source file encoding comments and updated the copyright notices
18
30
  * Fixed a tiny bug in lib/mtik/connection.rb
@@ -85,3 +97,4 @@
85
97
  fetch.rb
86
98
  * Added VERSION.txt, CHANGELOG.txt, README.txt, LICENSE.txt, and *.gemspec files, moved
87
99
  the example files into the bin subdirectory
100
+
data/Rakefile CHANGED
@@ -1,6 +1,6 @@
1
1
  require 'rubygems'
2
- require 'rake/gempackagetask'
3
- require 'rake/rdoctask'
2
+ require 'rubygems/package_task'
3
+ require 'rdoc/task'
4
4
 
5
5
  gemspec = Gem::Specification.new do |spec|
6
6
  spec.name = 'mtik'
@@ -35,12 +35,12 @@ gemspec = Gem::Specification.new do |spec|
35
35
  spec.executables = [ 'tikcli', 'tikcommand', 'tikfetch' ]
36
36
  end
37
37
 
38
- Rake::GemPackageTask.new(gemspec) do |pkg|
38
+ Gem::PackageTask.new(gemspec) do |pkg|
39
39
  pkg.need_zip = true
40
40
  pkg.need_tar = true
41
41
  end
42
42
 
43
- Rake::RDocTask.new do |rdoc|
43
+ RDoc::Task.new do |rdoc|
44
44
  rdoc.name = 'rdoc'
45
45
  rdoc.main = 'README.txt'
46
46
  rdoc.rdoc_dir = 'doc'
@@ -1 +1 @@
1
- 4.0.1
1
+ 4.0.2
@@ -50,7 +50,7 @@ class MTik::Connection
50
50
  ## +user+:: Override the default API username ('admin')
51
51
  ## +pass+:: Override the default API password (blank)
52
52
  ## +conn_timeout+:: Override the default connection
53
- ## timeout (60 seconds) -- *NOT USED*
53
+ ## timeout (60 seconds)
54
54
  ## +cmd_timeout+:: Override the default command timeout
55
55
  ## (60 seconds) -- the number of seconds
56
56
  ## to wait for additional API input.
@@ -130,9 +130,22 @@ class MTik::Connection
130
130
  ## Connect to the device
131
131
  def connect
132
132
  return unless @sock.nil?
133
- ## TODO: Perhaps catch more errors; implement connection timeout
133
+ ## TODO: Perhaps catch more errors
134
134
  begin
135
- @sock = TCPSocket::new(@host, @port)
135
+ addr = Socket.getaddrinfo(@host, nil)
136
+ @sock = Socket.new(Socket.const_get(addr[0][0]), Socket::SOCK_STREAM, 0)
137
+
138
+ begin
139
+ @sock.connect_nonblock(Socket.pack_sockaddr_in(@port, addr[0][3]))
140
+ rescue Errno::EINPROGRESS
141
+ ready = IO.select([@sock], [@sock], [], @conn_timeout)
142
+ if ready
143
+ @sock
144
+ else
145
+ raise Errno::ETIMEDOUT
146
+ end
147
+ end
148
+
136
149
  rescue Errno::ECONNREFUSED, Errno::ETIMEDOUT, Errno::ENETUNREACH,
137
150
  Errno::EHOSTUNREACH => e
138
151
  @sock = nil
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mtik
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.1
4
+ version: 4.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-09 00:00:00.000000000 Z
12
+ date: 2013-06-06 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: MTik implements the MikroTik RouterOS API for use in Ruby.
15
15
  email: email_not_accepted@aarongifford.com
@@ -57,7 +57,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
57
57
  version: '0'
58
58
  requirements: []
59
59
  rubyforge_project: mtik
60
- rubygems_version: 1.8.11
60
+ rubygems_version: 1.8.25
61
61
  signing_key:
62
62
  specification_version: 3
63
63
  summary: MTik implements the MikroTik RouterOS API for use in Ruby.