it_tools 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,5 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
5
+ *~
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in it_tools.gemspec
4
+ gemspec
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/bin/onVpn ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'it_tools/it_tools'
4
+
5
+ vpnTools = ItTools::VpnTools.new
6
+ puts vpnTools.on_vpn
data/bin/onVpn~ ADDED
File without changes
data/it_tools.gemspec ADDED
@@ -0,0 +1,24 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "it_tools/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "it_tools"
7
+ s.version = ItTools::VERSION
8
+ s.authors = ["Fenton Travers"]
9
+ s.email = ["fenton.travers@oracle.com"]
10
+ s.homepage = ""
11
+ s.summary = %q{automate repetitive tasks}
12
+ s.description = %q{tasks include checking in all of my repositories either internal or externally}
13
+
14
+ s.rubyforge_project = "it_tools"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ # specify any dependencies here; for example:
22
+ # s.add_development_dependency "rspec"
23
+ # s.add_runtime_dependency "rest-client"
24
+ end
@@ -0,0 +1,33 @@
1
+ require 'socket'
2
+ require 'timeout'
3
+
4
+ module ItTools
5
+ class VpnTools
6
+ def is_port_open?(ip, port)
7
+ begin
8
+ Timeout::timeout(1) do
9
+ begin
10
+ s = TCPSocket.new(ip, port)
11
+ s.close
12
+ return true
13
+ rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH
14
+ return false
15
+ end
16
+ end
17
+ rescue Timeout::Error
18
+ end
19
+ return false
20
+ end
21
+
22
+ def on_vpn
23
+ if is_port_open?("spicevan.com", 22)
24
+ return FALSE
25
+ else
26
+ return TRUE
27
+ end
28
+ end
29
+ end
30
+ end
31
+
32
+ abc = ItTools::VpnTools.new
33
+ abc.on_vpn
@@ -0,0 +1,3 @@
1
+ module ItTools
2
+ VERSION = "0.0.1"
3
+ end
data/lib/it_tools.rb ADDED
@@ -0,0 +1,5 @@
1
+ require "it_tools/version"
2
+
3
+ module ItTools
4
+ # Your code goes here...
5
+ end
metadata ADDED
@@ -0,0 +1,56 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: it_tools
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Fenton Travers
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-01-12 00:00:00.000000000Z
13
+ dependencies: []
14
+ description: tasks include checking in all of my repositories either internal or externally
15
+ email:
16
+ - fenton.travers@oracle.com
17
+ executables:
18
+ - onVpn
19
+ - onVpn~
20
+ extensions: []
21
+ extra_rdoc_files: []
22
+ files:
23
+ - .gitignore
24
+ - Gemfile
25
+ - Rakefile
26
+ - bin/onVpn
27
+ - bin/onVpn~
28
+ - it_tools.gemspec
29
+ - lib/it_tools.rb
30
+ - lib/it_tools/it_tools.rb
31
+ - lib/it_tools/version.rb
32
+ homepage: ''
33
+ licenses: []
34
+ post_install_message:
35
+ rdoc_options: []
36
+ require_paths:
37
+ - lib
38
+ required_ruby_version: !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ required_rubygems_version: !ruby/object:Gem::Requirement
45
+ none: false
46
+ requirements:
47
+ - - ! '>='
48
+ - !ruby/object:Gem::Version
49
+ version: '0'
50
+ requirements: []
51
+ rubyforge_project: it_tools
52
+ rubygems_version: 1.8.10
53
+ signing_key:
54
+ specification_version: 3
55
+ summary: automate repetitive tasks
56
+ test_files: []