tunnlr_connector 1.0.1 → 1.0.2
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/README +28 -0
- data/lib/tasks/tunnlr_connector_tasks.rake +18 -0
- data/lib/tunnlr.rb +10 -0
- data/lib/tunnlr/configurator.rb +4 -3
- data/lib/tunnlr/railtie.rb +12 -0
- metadata +21 -3
data/README
CHANGED
@@ -9,6 +9,34 @@ gem install --source http://gems.jamisbuck.org net-ssh
|
|
9
9
|
|
10
10
|
To run autoconfigure, it also requires the highline gem which is installed as part of capistrano.
|
11
11
|
|
12
|
+
Installation
|
13
|
+
============
|
14
|
+
|
15
|
+
Rails 2
|
16
|
+
-------
|
17
|
+
|
18
|
+
Add the gem to config/development.rb
|
19
|
+
|
20
|
+
config.gem 'tunnlr_connector', :lib => false
|
21
|
+
|
22
|
+
And add the following to the end of Rakefile
|
23
|
+
|
24
|
+
begin
|
25
|
+
require 'tunnlr'
|
26
|
+
Tunnlr.load_tasks if defined?(Tunnlr)
|
27
|
+
rescue LoadError => loaderror
|
28
|
+
$stderr.puts %{Couldn't load tunnlr}
|
29
|
+
end
|
30
|
+
|
31
|
+
Rails 3
|
32
|
+
-------
|
33
|
+
|
34
|
+
Add the gem to the development group of your Gemfile
|
35
|
+
|
36
|
+
gem 'tunnlr_connector', :require => false
|
37
|
+
|
38
|
+
That's it!
|
39
|
+
|
12
40
|
Example
|
13
41
|
=======
|
14
42
|
|
@@ -0,0 +1,18 @@
|
|
1
|
+
namespace :tunnlr do
|
2
|
+
|
3
|
+
desc "Create a tunnel"
|
4
|
+
task :start => :environment do
|
5
|
+
Tunnlr::Connector.new.connect!
|
6
|
+
end
|
7
|
+
|
8
|
+
desc "Write the tunnlr.yml file to your apps config directory"
|
9
|
+
task :configure => :environment do
|
10
|
+
Tunnlr::Configurator.new.configure(File.join(Rails.root,"config","tunnlr.yml"))
|
11
|
+
end
|
12
|
+
|
13
|
+
desc "Tunnlr UI requires the rubywx library"
|
14
|
+
task :ui => :environment do
|
15
|
+
require 'tunnlr/ui'
|
16
|
+
Tunnlr::Ui::MainApp.new.main_loop
|
17
|
+
end
|
18
|
+
end
|
data/lib/tunnlr.rb
CHANGED
@@ -1,2 +1,12 @@
|
|
1
1
|
require 'tunnlr/connector'
|
2
2
|
require 'tunnlr/configurator'
|
3
|
+
|
4
|
+
module Tunnlr
|
5
|
+
puts 'Loaded'
|
6
|
+
def self.load_tasks
|
7
|
+
Dir[File.expand_path("tasks/*.rake", File.dirname(__FILE__))].each { |ext| load ext }
|
8
|
+
end
|
9
|
+
|
10
|
+
require 'tunnlr/railtie' if defined?(Rails) && Rails::VERSION::MAJOR >= 3
|
11
|
+
|
12
|
+
end
|
data/lib/tunnlr/configurator.rb
CHANGED
@@ -2,14 +2,14 @@ require 'highline'
|
|
2
2
|
require 'net/ssh'
|
3
3
|
module Tunnlr
|
4
4
|
class Configurator
|
5
|
-
attr_accessor :not_configured,:email,:password
|
5
|
+
attr_accessor :not_configured,:email,:password,:subdomain
|
6
6
|
def initialize
|
7
7
|
@ui = HighLine.new
|
8
8
|
@not_configured=true
|
9
9
|
end
|
10
10
|
|
11
11
|
def fetch(username,password)
|
12
|
-
url=URI.parse(
|
12
|
+
url=URI.parse("http://#{subdomain}.tunnlr.com/configuration.yml")
|
13
13
|
req = Net::HTTP::Get.new(url.path)
|
14
14
|
req.basic_auth(username,password)
|
15
15
|
res = Net::HTTP.start(url.host, url.port) {|http|
|
@@ -30,6 +30,7 @@ module Tunnlr
|
|
30
30
|
|
31
31
|
def get_credentials
|
32
32
|
puts "Enter the email address and password you used to sign up for Tunnlr."
|
33
|
+
self.subdomain = @ui.ask("Subdomain (i.e. elevatedrails for elevatedrails.tunnlr.com): ")
|
33
34
|
self.email = @ui.ask("Email: ")
|
34
35
|
self.password = @ui.ask("Password: ") { |q| q.echo = false }
|
35
36
|
fetch(email,password)
|
@@ -39,7 +40,7 @@ module Tunnlr
|
|
39
40
|
while not_configured
|
40
41
|
begin
|
41
42
|
get_credentials
|
42
|
-
fetch(email,password)
|
43
|
+
fetch(subdomain,email,password)
|
43
44
|
add_password
|
44
45
|
write_config(path)
|
45
46
|
puts "Created configuration in #{path}"
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tunnlr_connector
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.
|
9
|
+
- 2
|
10
|
+
version: 1.0.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Mike Mangino
|
@@ -34,6 +34,22 @@ dependencies:
|
|
34
34
|
version: 2.0.15
|
35
35
|
type: :runtime
|
36
36
|
version_requirements: *id001
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: highline
|
39
|
+
prerelease: false
|
40
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
hash: 3
|
46
|
+
segments:
|
47
|
+
- 1
|
48
|
+
- 5
|
49
|
+
- 0
|
50
|
+
version: 1.5.0
|
51
|
+
type: :runtime
|
52
|
+
version_requirements: *id002
|
37
53
|
description: A simple plugin to make your local developnment environment available to the internet using the tunnlr.com service
|
38
54
|
email:
|
39
55
|
- mmangino@elevatedrails.com
|
@@ -44,8 +60,10 @@ extensions: []
|
|
44
60
|
extra_rdoc_files: []
|
45
61
|
|
46
62
|
files:
|
63
|
+
- lib/tasks/tunnlr_connector_tasks.rake
|
47
64
|
- lib/tunnlr/configurator.rb
|
48
65
|
- lib/tunnlr/connector.rb
|
66
|
+
- lib/tunnlr/railtie.rb
|
49
67
|
- lib/tunnlr/ui.rb
|
50
68
|
- lib/tunnlr.rb
|
51
69
|
- init.rb
|