it_tools 0.0.1
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.
- data/.gitignore +5 -0
- data/Gemfile +4 -0
- data/Rakefile +1 -0
- data/bin/onVpn +6 -0
- data/bin/onVpn~ +0 -0
- data/it_tools.gemspec +24 -0
- data/lib/it_tools/it_tools.rb +33 -0
- data/lib/it_tools/version.rb +3 -0
- data/lib/it_tools.rb +5 -0
- metadata +56 -0
    
        data/Gemfile
    ADDED
    
    
    
        data/Rakefile
    ADDED
    
    | @@ -0,0 +1 @@ | |
| 1 | 
            +
            require "bundler/gem_tasks"
         | 
    
        data/bin/onVpn
    ADDED
    
    
    
        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
         | 
    
        data/lib/it_tools.rb
    ADDED
    
    
    
        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: []
         |