tcpkicker 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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b547d11e4d5a9f7d766b6577c75a7fbae1e47ad7
4
+ data.tar.gz: 19a80eaa7872dc68b8150929b1cfe039e53590b0
5
+ SHA512:
6
+ metadata.gz: 42c346e936d78f24563e3408e5715e1f50ecb1bc038d0114f3ee9328f6ad316c1d1ff2743fa4d03abdad9e7bf3994c9426aa3c753d2570bd65ab3bf3e9fa08ca
7
+ data.tar.gz: a97cf044b008a584bc46f31f96c006e53caf0b7de7c35b96e30b7fcc39e4d80d541432d2fd2256dc4bbe6f8f6c41e2b2a7a81ab3389840dfa99073cdff80d7e7
data/.editorconfig ADDED
@@ -0,0 +1,11 @@
1
+ # EditorConfig is awesome: http://EditorConfig.org
2
+
3
+ root = true
4
+
5
+ [*.rb]
6
+ indent_style = space
7
+ indent_size = 2
8
+ end_of_line = lf
9
+ charset = utf-8
10
+ trim_trailing_whitespace = true
11
+ insert_final_newline = true
data/.gitignore ADDED
@@ -0,0 +1,35 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /test/tmp/
9
+ /test/version_tmp/
10
+ /tmp/
11
+ .idea
12
+
13
+ ## Specific to RubyMotion:
14
+ .dat*
15
+ .repl_history
16
+ build/
17
+
18
+ ## Documentation cache and generated files:
19
+ /.yardoc/
20
+ /_yardoc/
21
+ /doc/
22
+ /rdoc/
23
+
24
+ ## Environment normalisation:
25
+ /.bundle/
26
+ /lib/bundler/man/
27
+
28
+ # for a library or gem, you might want to ignore these files since the code is
29
+ # intended to run in multiple environments; otherwise, check them in:
30
+ # Gemfile.lock
31
+ # .ruby-version
32
+ # .ruby-gemset
33
+
34
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
35
+ .rvmrc
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in tcpkicker.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Naoyuki Kataoka
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
data/README.md ADDED
@@ -0,0 +1,43 @@
1
+ # tcpkicker
2
+
3
+ Fake tcp server to launch real tcp servers.
4
+
5
+ ## Installation
6
+
7
+ ```sh
8
+ gem install tcpkicker
9
+ ```
10
+
11
+ ## Quick start
12
+
13
+ ```sh
14
+ ./bin/tcpkicker -c ./lib/tcpkicker/config/config.yaml
15
+ ```
16
+
17
+ ## Usage
18
+
19
+ ```
20
+ Usage: tcpkicker [options]
21
+ -c, --config PATH configuration file path
22
+ ```
23
+
24
+ ## Configuration
25
+
26
+ ```yaml
27
+ port: 10012
28
+
29
+ servers:
30
+
31
+ - name: MySQL
32
+ port: 3306
33
+ description: MySQL server
34
+ execute: mysqld > /dev/null 2>&1
35
+ ```
36
+
37
+ ## Contributing
38
+
39
+ 1. Fork this repository
40
+ 2. Create a feature branch (`git checkout -b new-feature`)
41
+ 3. Commit some changes (`git commit -a`)
42
+ 4. Push to the branch (`git push origin new-feature`)
43
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
data/bin/tcpkicker ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ $:.push File.expand_path("../../lib", __FILE__)
3
+ require 'tcpkicker/cli'
4
+ Tcpkicker::Cli.start
data/lib/tcpkicker.rb ADDED
@@ -0,0 +1,2 @@
1
+ module Tcpkicker
2
+ end
@@ -0,0 +1,47 @@
1
+ require 'socket'
2
+ require 'yaml'
3
+ require 'optparse'
4
+
5
+ module Tcpkicker
6
+ module Cli
7
+ class << self
8
+
9
+ def start(args = ARGV)
10
+
11
+ opt = OptionParser.new
12
+
13
+ options = {
14
+ :config_path => '/etc/tcpkicker/config.yaml',
15
+ }
16
+
17
+ opt.on('-c', '--config PATH', 'configuration file path') { |v|
18
+ options[:config_path] = v
19
+ }
20
+
21
+ opt.parse(ARGV)
22
+
23
+ config = YAML.load_file(options[:config_path])
24
+
25
+ config['servers'].each { |server|
26
+ puts '[' + server['name'] + '] Listen to port ' + server['port'].to_s
27
+ Thread.start {
28
+ tcp_server = TCPServer.open(server['port'])
29
+ socket = tcp_server.accept
30
+ socket.close
31
+ tcp_server.close
32
+ puts '[' + server['name'] + '] Execute command `' + server['execute'] + '`'
33
+ system server['execute']
34
+ }
35
+ }
36
+
37
+ tcp_server = TCPServer.open(config['port'])
38
+ socket = tcp_server.accept
39
+ socket.close
40
+ tcp_server.close
41
+
42
+ end
43
+
44
+ end
45
+ end
46
+ end
47
+
@@ -0,0 +1,43 @@
1
+ port: 10012
2
+
3
+ servers:
4
+
5
+ - name: ZooKeeper
6
+ port: 2181
7
+ description: ZooKeeper server
8
+ execute: zookeeper > /dev/null 2>&1
9
+
10
+ - name: MySQL
11
+ port: 3306
12
+ description: MySQL server
13
+ execute: mysqld > /dev/null 2>&1
14
+
15
+ - name: Mesos
16
+ port: 5050
17
+ description: Mesos server
18
+ execute: mesos-local > /dev/null 2>&1
19
+
20
+ - name: Redis
21
+ port: 6379
22
+ description: Redis server
23
+ execute: redis-server > /dev/null 2>&1
24
+
25
+ - name: Cassandra
26
+ port: 9042
27
+ description: Cassandra server
28
+ execute: cassandra > /dev/null 2>&1
29
+
30
+ - name: Memcached
31
+ port: 11211
32
+ description: Memcached server
33
+ execute: memcached > /dev/null 2>&1
34
+
35
+ - name: Fluentd
36
+ port: 24224
37
+ description: Fluentd server
38
+ execute: fluentd > /dev/null 2>&1
39
+
40
+ - name: MongoDB
41
+ port: 27017
42
+ description: MongoDB server
43
+ execute: mongod > /dev/null 2>&1
@@ -0,0 +1,3 @@
1
+ module Tcpkicker
2
+ VERSION = '0.0.1'
3
+ end
data/tcpkicker.gemspec ADDED
@@ -0,0 +1,22 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'tcpkicker/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'tcpkicker'
8
+ spec.version = Tcpkicker::VERSION
9
+ spec.authors = ['Naoyuki Kataoka']
10
+ spec.email = ['kataokanaoyuki@gmail.com']
11
+ spec.summary = 'Fake tcp server to launch real tcp servers.'
12
+ spec.description = 'Fake tcp server to launch real tcp servers.'
13
+ spec.homepage = 'https://github.com/katty0324/tcpkicker'
14
+ spec.license = 'MIT'
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
18
+ spec.require_paths = ['lib']
19
+
20
+ spec.add_development_dependency 'bundler', '~> 1.8'
21
+ spec.add_development_dependency 'rake', '~> 10.0'
22
+ end
metadata ADDED
@@ -0,0 +1,84 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: tcpkicker
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Naoyuki Kataoka
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-02-10 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.8'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.8'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ description: Fake tcp server to launch real tcp servers.
42
+ email:
43
+ - kataokanaoyuki@gmail.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - .editorconfig
49
+ - .gitignore
50
+ - Gemfile
51
+ - LICENSE
52
+ - README.md
53
+ - Rakefile
54
+ - bin/tcpkicker
55
+ - lib/tcpkicker.rb
56
+ - lib/tcpkicker/cli.rb
57
+ - lib/tcpkicker/config/config.yaml
58
+ - lib/tcpkicker/version.rb
59
+ - tcpkicker.gemspec
60
+ homepage: https://github.com/katty0324/tcpkicker
61
+ licenses:
62
+ - MIT
63
+ metadata: {}
64
+ post_install_message:
65
+ rdoc_options: []
66
+ require_paths:
67
+ - lib
68
+ required_ruby_version: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - '>='
71
+ - !ruby/object:Gem::Version
72
+ version: '0'
73
+ required_rubygems_version: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ requirements: []
79
+ rubyforge_project:
80
+ rubygems_version: 2.0.14
81
+ signing_key:
82
+ specification_version: 4
83
+ summary: Fake tcp server to launch real tcp servers.
84
+ test_files: []