From 8da192b41af6de84299c1557296219c01b40f5e4 Mon Sep 17 00:00:00 2001 From: Jeff Lindsay Date: Mon, 2 May 2011 19:54:54 -0700 Subject: [PATCH] reorganizing ruby files and gem stuff --- Gemfile | 2 - Gemfile.lock | 21 ---------- Manifest | 3 +- Rakefile | 5 ++- bin/localtunnel | 13 +++--- lib/localtunnel.rb | 3 +- .../net_ssh_gateway_patch.rb | 4 -- .../tunnel.rb} | 7 +++- localtunnel.gemspec | 42 ------------------- 9 files changed, 19 insertions(+), 81 deletions(-) delete mode 100644 Gemfile delete mode 100644 Gemfile.lock rename lib/{ => localtunnel}/net_ssh_gateway_patch.rb (93%) rename lib/{local_tunnel.rb => localtunnel/tunnel.rb} (94%) delete mode 100644 localtunnel.gemspec diff --git a/Gemfile b/Gemfile deleted file mode 100644 index f98dbde..0000000 --- a/Gemfile +++ /dev/null @@ -1,2 +0,0 @@ -source :gemcutter -gemspec diff --git a/Gemfile.lock b/Gemfile.lock deleted file mode 100644 index a51bf72..0000000 --- a/Gemfile.lock +++ /dev/null @@ -1,21 +0,0 @@ -PATH - remote: . - specs: - localtunnel (0.2) - net-ssh - net-ssh-gateway - -GEM - remote: http://rubygems.org/ - specs: - net-ssh (2.1.4) - net-ssh-gateway (1.0.1) - net-ssh (>= 1.99.1) - -PLATFORMS - ruby - -DEPENDENCIES - localtunnel! - net-ssh - net-ssh-gateway diff --git a/Manifest b/Manifest index 3c9e0e5..2364226 100644 --- a/Manifest +++ b/Manifest @@ -1,5 +1,6 @@ Rakefile lib/localtunnel.rb +lib/localtunnel/tunnel.rb +lib/localtunnel/net_ssh_gateway_patch.rb bin/localtunnel -server.py Manifest diff --git a/Rakefile b/Rakefile index cc7ff6a..0db0f2f 100644 --- a/Rakefile +++ b/Rakefile @@ -2,11 +2,14 @@ require 'rubygems' require 'rake' require 'echoe' -Echoe.new('localtunnel', '0.2') do |p| +Echoe.new('localtunnel', '0.3') do |p| p.description = "instant public tunnel to your local web server" p.url = "http://github.com/progrium/localtunnel" p.author = "Jeff Lindsay" p.email = "jeff.lindsay@twilio.com" + p.has_rdoc = false + p.rdoc_pattern = // + p.rdoc_options = [] p.ignore_pattern = ["tmp/*", "script/*"] p.executable_pattern = ["bin/*"] p.runtime_dependencies = ["json >=1.2.4", "net-ssh >=2.0.22", "net-ssh-gateway >=1.0.1"] diff --git a/bin/localtunnel b/bin/localtunnel index 54bdd1d..96a025b 100755 --- a/bin/localtunnel +++ b/bin/localtunnel @@ -22,10 +22,9 @@ # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR # OTHER DEALINGS IN THE SOFTWARE. -base_dir = File.dirname(File.expand_path(__FILE__)) - -require base_dir + '/../lib/local_tunnel' -require base_dir + '/../lib/net_ssh_gateway_patch' +require 'rubygems' +require 'optparse' +require 'localtunnel' key = nil options = OptionParser.new do |o| @@ -43,6 +42,6 @@ unless local_port exit end -x = LocalTunnel.new(local_port, key) -x.register_tunnel -x.start_tunnel \ No newline at end of file +t = LocalTunnel::Tunnel.new(local_port, key) +t.register_tunnel +t.start_tunnel \ No newline at end of file diff --git a/lib/localtunnel.rb b/lib/localtunnel.rb index 20b6e2f..6cb7b35 100644 --- a/lib/localtunnel.rb +++ b/lib/localtunnel.rb @@ -1 +1,2 @@ -## Nothing to see here \ No newline at end of file +$: << File.expand_path(File.dirname(__FILE__)) +require 'localtunnel/tunnel' diff --git a/lib/net_ssh_gateway_patch.rb b/lib/localtunnel/net_ssh_gateway_patch.rb similarity index 93% rename from lib/net_ssh_gateway_patch.rb rename to lib/localtunnel/net_ssh_gateway_patch.rb index a851823..6a5304a 100644 --- a/lib/net_ssh_gateway_patch.rb +++ b/lib/localtunnel/net_ssh_gateway_patch.rb @@ -1,10 +1,6 @@ require 'rubygems' require 'net/ssh' require 'net/ssh/gateway' -require 'net/http' -require 'uri' -require 'optparse' -require 'json' # http://groups.google.com/group/capistrano/browse_thread/thread/455c0c8a6faa9cc8?pli=1 class Net::SSH::Gateway diff --git a/lib/local_tunnel.rb b/lib/localtunnel/tunnel.rb similarity index 94% rename from lib/local_tunnel.rb rename to lib/localtunnel/tunnel.rb index 889a356..33edcc5 100644 --- a/lib/local_tunnel.rb +++ b/lib/localtunnel/tunnel.rb @@ -3,10 +3,13 @@ require 'net/ssh/gateway' require 'net/http' require 'uri' -require 'optparse' require 'json' -class LocalTunnel +require 'localtunnel/net_ssh_gateway_patch' + +module LocalTunnel; end + +class LocalTunnel::Tunnel attr_accessor :port, :key, :host diff --git a/localtunnel.gemspec b/localtunnel.gemspec deleted file mode 100644 index 12dfbf1..0000000 --- a/localtunnel.gemspec +++ /dev/null @@ -1,42 +0,0 @@ -# -*- encoding: utf-8 -*- - -Gem::Specification.new do |s| - s.name = %q{localtunnel} - s.version = "0.2" - - s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version= - s.authors = ["Jeff Lindsay"] - s.cert_chain = ["/Users/progrium/.gem/gem-public_cert.pem"] - s.date = %q{2011-05-02} - s.default_executable = %q{localtunnel} - s.description = %q{instant public tunnel to your local web server} - s.email = %q{jeff.lindsay@twilio.com} - s.executables = ["localtunnel"] - s.extra_rdoc_files = ["lib/localtunnel.rb", "bin/localtunnel"] - s.files = ["Rakefile", "lib/localtunnel.rb", "bin/localtunnel", "server.py", "Manifest", "localtunnel.gemspec"] - s.homepage = %q{http://github.com/progrium/localtunnel} - s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Localtunnel", "--main", "README.rdoc"] - s.require_paths = ["lib"] - s.rubyforge_project = %q{localtunnel} - s.rubygems_version = %q{1.4.1} - s.signing_key = %q{/Users/progrium/.gem/gem-private_key.pem} - s.summary = %q{instant public tunnel to your local web server} - - if s.respond_to? :specification_version then - s.specification_version = 3 - - if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then - s.add_runtime_dependency(%q, [">= 1.2.4"]) - s.add_runtime_dependency(%q, [">= 2.0.22"]) - s.add_runtime_dependency(%q, [">= 1.0.1"]) - else - s.add_dependency(%q, [">= 1.2.4"]) - s.add_dependency(%q, [">= 2.0.22"]) - s.add_dependency(%q, [">= 1.0.1"]) - end - else - s.add_dependency(%q, [">= 1.2.4"]) - s.add_dependency(%q, [">= 2.0.22"]) - s.add_dependency(%q, [">= 1.0.1"]) - end -end