puma-ngrok-tunnel 0.1.0
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 +7 -0
- data/.gitignore +11 -0
- data/.travis.yml +4 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +74 -0
- data/Rakefile +10 -0
- data/lib/puma/plugin/ngrok_tunnel.rb +27 -0
- data/lib/puma-ngrok-tunnel/version.rb +3 -0
- data/puma-ngrok-tunnel.gemspec +38 -0
- metadata +116 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 3227a5d893088f72be76945ce1e5c421026e521fc46e5ff97cde4306a090eef2
|
4
|
+
data.tar.gz: 2326bb0ae39d5b07ce731ee326068c440dc739782a7fbd43a3996ac8429d32a1
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: dc740df330bb4896132983e8766888d274c0294873989c1f489e96c63892a5d2258d4dbc8d826b2c4ed4fdec7134a9e58b8da646ad2e043b0be8a948c6768fc1
|
7
|
+
data.tar.gz: d68ee5cf93fb39e49505d34772dd01af5f8cb86e89a868d36f5914eb537f36cf53a95d9b6939104337828243525423eb243d7d3fc5bac560af7927221b63c945
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Evan Phoenix
|
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
|
13
|
+
all 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
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# puma-ngrok-tunnel
|
2
|
+
|
3
|
+
A plugin for puma that'll start a ngrok tunnel to your rails server. Built to make it easier to build apps that require webhooks to work as expected.
|
4
|
+
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
Make sure you have installed ngrok on your machine:
|
9
|
+
|
10
|
+
$ brew install ngrok
|
11
|
+
|
12
|
+
Add this line to your application's Gemfile:
|
13
|
+
|
14
|
+
```ruby
|
15
|
+
group :development do
|
16
|
+
gem 'puma-ngrok-tunnel'
|
17
|
+
end
|
18
|
+
```
|
19
|
+
|
20
|
+
And then execute:
|
21
|
+
|
22
|
+
$ bundle
|
23
|
+
|
24
|
+
Lastly in your `config/puma.rb` file, append the line:
|
25
|
+
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
plugin :ngrok_tunnel if ENV['NGROK_TUNNEL_ENABLED']
|
29
|
+
```
|
30
|
+
|
31
|
+
## Installation with puma-dev
|
32
|
+
|
33
|
+
Add the environmental variable (in a .env file for example):
|
34
|
+
|
35
|
+
```
|
36
|
+
CONFIG=config/puma.rb
|
37
|
+
```
|
38
|
+
|
39
|
+
## Usage
|
40
|
+
|
41
|
+
Read about how to configure puma to use this plugin here: https://github.com/puma/puma#plugins
|
42
|
+
|
43
|
+
There are a few variables this plugin reads from the environment which control its behavior. These are based on the arguments you'd pass to the [ngrok terminal command](https://ngrok.com/docs#http-subdomain).
|
44
|
+
|
45
|
+
* `PORT` - defaults to 3000
|
46
|
+
* `NGROK_ADDR`
|
47
|
+
* `NGROK_AUTHTOKEN`
|
48
|
+
* `NGROK_HOST_HEADER`
|
49
|
+
* `NGROK_CONFIG`
|
50
|
+
* `NGROK_SUBDOMAIN`
|
51
|
+
* `NGROK_REGION`
|
52
|
+
* `NGROK_HOSTNAME` - Full ngrok hostname, shouldn't be set if `NGROK_SUBDOMAIN` is set.
|
53
|
+
|
54
|
+
### Sample .env
|
55
|
+
|
56
|
+
```
|
57
|
+
# Puma-dev: You need to define this otherwise it uses it's own puma.rb file.
|
58
|
+
CONFIG=config/puma.rb
|
59
|
+
|
60
|
+
# puma-ngrok-tunnel setup
|
61
|
+
# These should start with 'export' otherwise puma-dev won't use them.
|
62
|
+
export NGROK_TUNNEL_ENABLED=true
|
63
|
+
export NGROK_SUBDOMAIN=my-app-name
|
64
|
+
export NGROK_REGION=eu
|
65
|
+
# The URL (and HTTPS Port) you might use to access this under Puma-dev
|
66
|
+
export NGROK_ADDR=my-app-name.test:443
|
67
|
+
export NGROK_HOST_HEADER=my-app-name.test
|
68
|
+
```
|
69
|
+
|
70
|
+
|
71
|
+
## License
|
72
|
+
|
73
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
74
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'ngrok/tunnel'
|
2
|
+
|
3
|
+
Puma::Plugin.create do
|
4
|
+
def start(_dsl)
|
5
|
+
in_background do
|
6
|
+
puts '[puma-ngrok-tunnel] Starting'
|
7
|
+
puts '[puma-ngrok-tunnel] Tunneling at: ' + Ngrok::Tunnel.start(options)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def options
|
12
|
+
@options ||= {
|
13
|
+
addr: ENV.fetch('NGROK_ADDR') { nil } || ENV.fetch('PORT') { 3000 },
|
14
|
+
authtoken: ENV.fetch('NGROK_AUTHTOKEN') { nil },
|
15
|
+
host_header: ENV.fetch('NGROK_HOST_HEADER') { nil },
|
16
|
+
config: ENV.fetch('NGROK_CONFIG') { File.join(ENV['HOME'], '.ngrok2', 'ngrok.yml') },
|
17
|
+
subdomain: ENV.fetch('NGROK_SUBDOMAIN') { nil },
|
18
|
+
region: ENV.fetch('NGROK_REGION') { nil },
|
19
|
+
hostname: ENV.fetch('NGROK_HOSTNAME') { nil }
|
20
|
+
}.reject { |_, value| value.nil? }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
at_exit do
|
25
|
+
puts '[puma-ngrok-tunnel] Stopping'
|
26
|
+
Ngrok::Tunnel.stop
|
27
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
lib = File.expand_path("../lib", __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require "puma-ngrok-tunnel/version"
|
4
|
+
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'puma-ngrok-tunnel'
|
8
|
+
spec.version = PumaNgrokTunnel::VERSION
|
9
|
+
spec.authors = ['Mike Rogers']
|
10
|
+
spec.email = ['me@mikerogers.io']
|
11
|
+
|
12
|
+
spec.summary = 'Puma integration for starting a Ngrok Tunnel'
|
13
|
+
spec.description = 'A Puma plugin that opens a ngrok tunnel after the rails server starts'
|
14
|
+
spec.homepage = 'https://github.com/mikerogers0/puma-ngrok-tunnel'
|
15
|
+
spec.license = 'MIT'
|
16
|
+
|
17
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
18
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
19
|
+
if spec.respond_to?(:metadata)
|
20
|
+
spec.metadata["allowed_push_host"] = 'https://rubygems.org'
|
21
|
+
else
|
22
|
+
raise "RubyGems 2.0 or newer is required to protect against " \
|
23
|
+
"public gem pushes."
|
24
|
+
end
|
25
|
+
|
26
|
+
# Specify which files should be added to the gem when it is released.
|
27
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
28
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
29
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
30
|
+
end
|
31
|
+
spec.require_paths = ['lib']
|
32
|
+
|
33
|
+
spec.add_runtime_dependency 'ngrok-tunnel', '~> 2.1', '>= 2.1.1'
|
34
|
+
spec.add_runtime_dependency 'puma', '~> 3.0'
|
35
|
+
|
36
|
+
spec.add_development_dependency 'bundler', '~> 1.11'
|
37
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
38
|
+
end
|
metadata
ADDED
@@ -0,0 +1,116 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: puma-ngrok-tunnel
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Mike Rogers
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-05-04 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: ngrok-tunnel
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.1'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 2.1.1
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '2.1'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 2.1.1
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: puma
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '3.0'
|
40
|
+
type: :runtime
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - "~>"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '3.0'
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: bundler
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - "~>"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '1.11'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - "~>"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '1.11'
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: rake
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - "~>"
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '10.0'
|
68
|
+
type: :development
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - "~>"
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '10.0'
|
75
|
+
description: A Puma plugin that opens a ngrok tunnel after the rails server starts
|
76
|
+
email:
|
77
|
+
- me@mikerogers.io
|
78
|
+
executables: []
|
79
|
+
extensions: []
|
80
|
+
extra_rdoc_files: []
|
81
|
+
files:
|
82
|
+
- ".gitignore"
|
83
|
+
- ".travis.yml"
|
84
|
+
- Gemfile
|
85
|
+
- LICENSE.txt
|
86
|
+
- README.md
|
87
|
+
- Rakefile
|
88
|
+
- lib/puma-ngrok-tunnel/version.rb
|
89
|
+
- lib/puma/plugin/ngrok_tunnel.rb
|
90
|
+
- puma-ngrok-tunnel.gemspec
|
91
|
+
homepage: https://github.com/mikerogers0/puma-ngrok-tunnel
|
92
|
+
licenses:
|
93
|
+
- MIT
|
94
|
+
metadata:
|
95
|
+
allowed_push_host: https://rubygems.org
|
96
|
+
post_install_message:
|
97
|
+
rdoc_options: []
|
98
|
+
require_paths:
|
99
|
+
- lib
|
100
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - ">="
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - ">="
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
requirements: []
|
111
|
+
rubyforge_project:
|
112
|
+
rubygems_version: 2.7.6
|
113
|
+
signing_key:
|
114
|
+
specification_version: 4
|
115
|
+
summary: Puma integration for starting a Ngrok Tunnel
|
116
|
+
test_files: []
|