proxymachine 1.2.3 → 1.2.4

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "http://rubygems.org"
2
+
3
+ gemspec
@@ -1,3 +1,8 @@
1
+ = 1.2.4 / 2011-02-01
2
+ * Bug fixes
3
+ * Fix version number in procline
4
+ * Unrequire rubygems. Some people consider this a bug.
5
+
1
6
  = 1.2.3 / 2010-02-23
2
7
  * Bug fixes
3
8
  * Never retry after connection is established and data is sent
@@ -38,4 +43,4 @@
38
43
 
39
44
  = 0.2.7 / 2009-10-12
40
45
  * Minor changes
41
- * Use a 10k buffer to prevent memory growth due to slow clients
46
+ * Use a 10k buffer to prevent memory growth due to slow clients
data/Rakefile CHANGED
@@ -1,57 +1,150 @@
1
1
  require 'rubygems'
2
2
  require 'rake'
3
+ require 'date'
3
4
 
4
- begin
5
- require 'jeweler'
6
- Jeweler::Tasks.new do |gem|
7
- gem.name = "proxymachine"
8
- gem.summary = %Q{ProxyMachine is a simple content aware (layer 7) TCP routing proxy.}
9
- gem.email = "tom@mojombo.com"
10
- gem.homepage = "http://github.com/mojombo/proxymachine"
11
- gem.authors = ["Tom Preston-Werner"]
12
- gem.add_dependency('eventmachine', '>= 0.12.10')
13
-
14
- # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
15
- end
16
- rescue LoadError
17
- puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
5
+ #############################################################################
6
+ #
7
+ # Helper functions
8
+ #
9
+ #############################################################################
10
+
11
+ def name
12
+ @name ||= Dir['*.gemspec'].first.split('.').first
13
+ end
14
+
15
+ def version
16
+ line = File.read("lib/#{name}.rb")[/^\s*VERSION\s*=\s*.*/]
17
+ line.match(/.*VERSION\s*=\s*['"](.*)['"]/)[1]
18
+ end
19
+
20
+ def date
21
+ Date.today.to_s
22
+ end
23
+
24
+ def rubyforge_project
25
+ name
26
+ end
27
+
28
+ def gemspec_file
29
+ "#{name}.gemspec"
30
+ end
31
+
32
+ def gem_file
33
+ "#{name}-#{version}.gem"
34
+ end
35
+
36
+ def replace_header(head, header_name)
37
+ head.sub!(/(\.#{header_name}\s*= ').*'/) { "#{$1}#{send(header_name)}'"}
18
38
  end
19
39
 
40
+ #############################################################################
41
+ #
42
+ # Standard tasks
43
+ #
44
+ #############################################################################
45
+
46
+ task :default => :test
47
+
20
48
  require 'rake/testtask'
21
49
  Rake::TestTask.new(:test) do |test|
22
50
  test.libs << 'lib' << 'test'
23
- test.pattern = 'test/**/*_test.rb'
51
+ test.pattern = 'test/**/test_*.rb'
24
52
  test.verbose = true
25
53
  end
26
54
 
27
- begin
28
- require 'rcov/rcovtask'
29
- Rcov::RcovTask.new do |test|
30
- test.libs << 'test'
31
- test.pattern = 'test/**/*_test.rb'
32
- test.verbose = true
33
- end
34
- rescue LoadError
35
- task :rcov do
36
- abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
37
- end
55
+ desc "Generate RCov test coverage and open in your browser"
56
+ task :coverage do
57
+ require 'rcov'
58
+ sh "rm -fr coverage"
59
+ sh "rcov test/test_*.rb"
60
+ sh "open coverage/index.html"
38
61
  end
39
62
 
40
-
41
- task :default => :test
42
-
43
63
  require 'rake/rdoctask'
44
64
  Rake::RDocTask.new do |rdoc|
45
- if File.exist?('VERSION.yml')
46
- config = YAML.load(File.read('VERSION.yml'))
47
- version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
48
- else
49
- version = ""
50
- end
51
-
52
65
  rdoc.rdoc_dir = 'rdoc'
53
- rdoc.title = "proxymachine #{version}"
66
+ rdoc.title = "#{name} #{version}"
54
67
  rdoc.rdoc_files.include('README*')
55
68
  rdoc.rdoc_files.include('lib/**/*.rb')
56
69
  end
57
70
 
71
+ desc "Open an irb session preloaded with this library"
72
+ task :console do
73
+ sh "irb -rubygems -r ./lib/#{name}.rb"
74
+ end
75
+
76
+ #############################################################################
77
+ #
78
+ # Custom tasks (add your own tasks here)
79
+ #
80
+ #############################################################################
81
+
82
+
83
+
84
+ #############################################################################
85
+ #
86
+ # Packaging tasks
87
+ #
88
+ #############################################################################
89
+
90
+ desc "Create tag v#{version} and build and push #{gem_file} to Rubygems"
91
+ task :release => :build do
92
+ unless `git branch` =~ /^\* master$/
93
+ puts "You must be on the master branch to release!"
94
+ exit!
95
+ end
96
+ sh "git commit --allow-empty -a -m 'Release #{version}'"
97
+ sh "git tag v#{version}"
98
+ sh "git push origin master"
99
+ sh "git push origin v#{version}"
100
+ sh "gem push pkg/#{name}-#{version}.gem"
101
+ end
102
+
103
+ desc "Build #{gem_file} into the pkg directory"
104
+ task :build => :gemspec do
105
+ sh "mkdir -p pkg"
106
+ sh "gem build #{gemspec_file}"
107
+ sh "mv #{gem_file} pkg"
108
+ end
109
+
110
+ desc "Generate #{gemspec_file}"
111
+ task :gemspec => :validate do
112
+ # read spec file and split out manifest section
113
+ spec = File.read(gemspec_file)
114
+ head, manifest, tail = spec.split(" # = MANIFEST =\n")
115
+
116
+ # replace name version and date
117
+ replace_header(head, :name)
118
+ replace_header(head, :version)
119
+ replace_header(head, :date)
120
+ #comment this out if your rubyforge_project has a different name
121
+ replace_header(head, :rubyforge_project)
122
+
123
+ # determine file list from git ls-files
124
+ files = `git ls-files`.
125
+ split("\n").
126
+ sort.
127
+ reject { |file| file =~ /^\./ }.
128
+ reject { |file| file =~ /^(rdoc|pkg)/ }.
129
+ map { |file| " #{file}" }.
130
+ join("\n")
131
+
132
+ # piece file back together and write
133
+ manifest = " s.files = %w[\n#{files}\n ]\n"
134
+ spec = [head, manifest, tail].join(" # = MANIFEST =\n")
135
+ File.open(gemspec_file, 'w') { |io| io.write(spec) }
136
+ puts "Updated #{gemspec_file}"
137
+ end
138
+
139
+ desc "Validate #{gemspec_file}"
140
+ task :validate do
141
+ libfiles = Dir['lib/*'] - ["lib/#{name}.rb", "lib/#{name}"]
142
+ unless libfiles.empty?
143
+ puts "Directory `lib` should only contain a `#{name}.rb` file and `#{name}` dir."
144
+ exit!
145
+ end
146
+ unless Dir['VERSION*'].empty?
147
+ puts "A `VERSION` file at root level violates Gem best practices."
148
+ exit!
149
+ end
150
+ end
@@ -1,4 +1,4 @@
1
- require 'rubygems'
1
+ require 'yaml'
2
2
  require 'eventmachine'
3
3
  require 'logger'
4
4
  require 'socket'
@@ -9,6 +9,8 @@ require 'proxymachine/server_connection'
9
9
  LOGGER = Logger.new(STDOUT)
10
10
 
11
11
  class ProxyMachine
12
+ VERSION = '1.2.4'
13
+
12
14
  MAX_FAST_SHUTDOWN_SECONDS = 10
13
15
 
14
16
  def self.update_procline
@@ -110,15 +112,6 @@ class ProxyMachine
110
112
  end
111
113
  end
112
114
  end
113
-
114
- def self.version
115
- yml = YAML.load(File.read(File.join(File.dirname(__FILE__), *%w[.. VERSION.yml])))
116
- "#{yml[:major]}.#{yml[:minor]}.#{yml[:patch]}"
117
- rescue
118
- 'unknown'
119
- end
120
-
121
- VERSION = self.version
122
115
  end
123
116
 
124
117
  module Kernel
@@ -1,67 +1,82 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in rakefile, and run the gemspec command
4
- # -*- encoding: utf-8 -*-
5
-
1
+ ## This is the rakegem gemspec template. Make sure you read and understand
2
+ ## all of the comments. Some sections require modification, and others can
3
+ ## be deleted if you don't need them. Once you understand the contents of
4
+ ## this file, feel free to delete any comments that begin with two hash marks.
5
+ ## You can find comprehensive Gem::Specification documentation, at
6
+ ## http://docs.rubygems.org/read/chapter/20
6
7
  Gem::Specification.new do |s|
7
- s.name = %q{proxymachine}
8
- s.version = "1.2.3"
9
-
8
+ s.specification_version = 2 if s.respond_to? :specification_version=
10
9
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Tom Preston-Werner"]
12
- s.date = %q{2010-02-23}
13
- s.default_executable = %q{proxymachine}
14
- s.email = %q{tom@mojombo.com}
10
+ s.rubygems_version = '1.3.5'
11
+
12
+ ## Leave these as is they will be modified for you by the rake gemspec task.
13
+ ## If your rubyforge_project name is different, then edit it and comment out
14
+ ## the sub! line in the Rakefile
15
+ s.name = 'proxymachine'
16
+ s.version = '1.2.4'
17
+ s.date = '2011-02-01'
18
+ s.rubyforge_project = 'proxymachine'
19
+
20
+ ## Make sure your summary is short. The description may be as long
21
+ ## as you like.
22
+ s.summary = "ProxyMachine is a simple content aware (layer 7) TCP routing proxy."
23
+ s.description = "ProxyMachine is a simple content aware (layer 7) TCP routing proxy written in Ruby with EventMachine."
24
+
25
+ ## List the primary authors. If there are a bunch of authors, it's probably
26
+ ## better to set the email to an email list or something. If you don't have
27
+ ## a custom homepage, consider using your GitHub URL or the like.
28
+ s.authors = ["Tom Preston-Werner"]
29
+ s.email = 'tom@mojombo.com'
30
+ s.homepage = 'http://github.com/mojombo/proxymachine'
31
+
32
+ ## This gets added to the $LOAD_PATH so that 'lib/NAME.rb' can be required as
33
+ ## require 'NAME.rb' or'/lib/NAME/file.rb' can be as require 'NAME/file.rb'
34
+ s.require_paths = %w[lib]
35
+
36
+ ## If your gem includes any executables, list them here.
15
37
  s.executables = ["proxymachine"]
16
- s.extra_rdoc_files = [
17
- "LICENSE",
18
- "README.md"
19
- ]
20
- s.files = [
21
- ".document",
22
- ".gitignore",
23
- "History.txt",
24
- "LICENSE",
25
- "README.md",
26
- "Rakefile",
27
- "VERSION.yml",
28
- "bin/proxymachine",
29
- "examples/git.rb",
30
- "examples/long.rb",
31
- "examples/transparent.rb",
32
- "lib/proxymachine.rb",
33
- "lib/proxymachine/client_connection.rb",
34
- "lib/proxymachine/server_connection.rb",
35
- "proxymachine.gemspec",
36
- "test/configs/simple.rb",
37
- "test/proxymachine_test.rb",
38
- "test/test_helper.rb"
39
- ]
40
- s.homepage = %q{http://github.com/mojombo/proxymachine}
38
+ s.default_executable = 'proxymachine'
39
+
40
+ ## Specify any RDoc options here. You'll want to add your README and
41
+ ## LICENSE files to the extra_rdoc_files list.
41
42
  s.rdoc_options = ["--charset=UTF-8"]
42
- s.require_paths = ["lib"]
43
- s.rubygems_version = %q{1.3.5}
44
- s.summary = %q{ProxyMachine is a simple content aware (layer 7) TCP routing proxy.}
45
- s.test_files = [
46
- "test/configs/simple.rb",
47
- "test/proxymachine_test.rb",
48
- "test/test_helper.rb",
49
- "examples/git.rb",
50
- "examples/long.rb",
51
- "examples/transparent.rb"
52
- ]
43
+ s.extra_rdoc_files = %w[README.md LICENSE]
53
44
 
54
- if s.respond_to? :specification_version then
55
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
56
- s.specification_version = 3
45
+ ## List your runtime dependencies here. Runtime dependencies are those
46
+ ## that are needed for an end user to actually USE your code.
47
+ s.add_runtime_dependency(%q<eventmachine>, [">= 0.12.10"])
57
48
 
58
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
59
- s.add_runtime_dependency(%q<eventmachine>, [">= 0.12.10"])
60
- else
61
- s.add_dependency(%q<eventmachine>, [">= 0.12.10"])
62
- end
63
- else
64
- s.add_dependency(%q<eventmachine>, [">= 0.12.10"])
65
- end
66
- end
49
+ ## List your development dependencies here. Development dependencies are
50
+ ## those that are only needed during development
51
+ s.add_development_dependency(%q<rake>, ["~> 0.8.7"])
52
+ s.add_development_dependency(%q<shoulda>, ["~> 2.11.3"])
53
+ s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
67
54
 
55
+ ## Leave this section as-is. It will be automatically generated from the
56
+ ## contents of your Git repository via the gemspec task. DO NOT REMOVE
57
+ ## THE MANIFEST COMMENTS, they are used as delimiters by the task.
58
+ # = MANIFEST =
59
+ s.files = %w[
60
+ Gemfile
61
+ History.txt
62
+ LICENSE
63
+ README.md
64
+ Rakefile
65
+ bin/proxymachine
66
+ examples/git.rb
67
+ examples/long.rb
68
+ examples/transparent.rb
69
+ lib/proxymachine.rb
70
+ lib/proxymachine/client_connection.rb
71
+ lib/proxymachine/server_connection.rb
72
+ proxymachine.gemspec
73
+ test/configs/simple.rb
74
+ test/proxymachine_test.rb
75
+ test/test_helper.rb
76
+ ]
77
+ # = MANIFEST =
78
+
79
+ ## Test files will be grabbed from the file list. Make sure the path glob
80
+ ## matches what you actually use.
81
+ s.test_files = s.files.select { |path| path =~ /^test\/.*_test\.rb$/ }
82
+ end
metadata CHANGED
@@ -1,7 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: proxymachine
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.3
4
+ hash: 23
5
+ prerelease: false
6
+ segments:
7
+ - 1
8
+ - 2
9
+ - 4
10
+ version: 1.2.4
5
11
  platform: ruby
6
12
  authors:
7
13
  - Tom Preston-Werner
@@ -9,36 +15,88 @@ autorequire:
9
15
  bindir: bin
10
16
  cert_chain: []
11
17
 
12
- date: 2010-02-23 00:00:00 -08:00
18
+ date: 2011-02-01 00:00:00 -08:00
13
19
  default_executable: proxymachine
14
20
  dependencies:
15
21
  - !ruby/object:Gem::Dependency
16
22
  name: eventmachine
17
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
20
26
  requirements:
21
27
  - - ">="
22
28
  - !ruby/object:Gem::Version
29
+ hash: 59
30
+ segments:
31
+ - 0
32
+ - 12
33
+ - 10
23
34
  version: 0.12.10
24
- version:
25
- description:
35
+ type: :runtime
36
+ version_requirements: *id001
37
+ - !ruby/object:Gem::Dependency
38
+ name: rake
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ hash: 49
46
+ segments:
47
+ - 0
48
+ - 8
49
+ - 7
50
+ version: 0.8.7
51
+ type: :development
52
+ version_requirements: *id002
53
+ - !ruby/object:Gem::Dependency
54
+ name: shoulda
55
+ prerelease: false
56
+ requirement: &id003 !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ hash: 37
62
+ segments:
63
+ - 2
64
+ - 11
65
+ - 3
66
+ version: 2.11.3
67
+ type: :development
68
+ version_requirements: *id003
69
+ - !ruby/object:Gem::Dependency
70
+ name: jeweler
71
+ prerelease: false
72
+ requirement: &id004 !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ hash: 7
78
+ segments:
79
+ - 1
80
+ - 5
81
+ - 2
82
+ version: 1.5.2
83
+ type: :development
84
+ version_requirements: *id004
85
+ description: ProxyMachine is a simple content aware (layer 7) TCP routing proxy written in Ruby with EventMachine.
26
86
  email: tom@mojombo.com
27
87
  executables:
28
88
  - proxymachine
29
89
  extensions: []
30
90
 
31
91
  extra_rdoc_files:
32
- - LICENSE
33
92
  - README.md
93
+ - LICENSE
34
94
  files:
35
- - .document
36
- - .gitignore
95
+ - Gemfile
37
96
  - History.txt
38
97
  - LICENSE
39
98
  - README.md
40
99
  - Rakefile
41
- - VERSION.yml
42
100
  - bin/proxymachine
43
101
  - examples/git.rb
44
102
  - examples/long.rb
@@ -60,28 +118,29 @@ rdoc_options:
60
118
  require_paths:
61
119
  - lib
62
120
  required_ruby_version: !ruby/object:Gem::Requirement
121
+ none: false
63
122
  requirements:
64
123
  - - ">="
65
124
  - !ruby/object:Gem::Version
125
+ hash: 3
126
+ segments:
127
+ - 0
66
128
  version: "0"
67
- version:
68
129
  required_rubygems_version: !ruby/object:Gem::Requirement
130
+ none: false
69
131
  requirements:
70
132
  - - ">="
71
133
  - !ruby/object:Gem::Version
134
+ hash: 3
135
+ segments:
136
+ - 0
72
137
  version: "0"
73
- version:
74
138
  requirements: []
75
139
 
76
- rubyforge_project:
77
- rubygems_version: 1.3.5
140
+ rubyforge_project: proxymachine
141
+ rubygems_version: 1.3.7
78
142
  signing_key:
79
- specification_version: 3
143
+ specification_version: 2
80
144
  summary: ProxyMachine is a simple content aware (layer 7) TCP routing proxy.
81
145
  test_files:
82
- - test/configs/simple.rb
83
146
  - test/proxymachine_test.rb
84
- - test/test_helper.rb
85
- - examples/git.rb
86
- - examples/long.rb
87
- - examples/transparent.rb
data/.document DELETED
@@ -1,5 +0,0 @@
1
- README.rdoc
2
- lib/**/*.rb
3
- bin/*
4
- features/**/*.feature
5
- LICENSE
data/.gitignore DELETED
@@ -1,5 +0,0 @@
1
- *.sw?
2
- .DS_Store
3
- coverage
4
- rdoc
5
- pkg
@@ -1,5 +0,0 @@
1
- ---
2
- :major: 1
3
- :minor: 2
4
- :patch: 3
5
- :build: