Class: RubyNative::CLI::Preview
- Inherits:
-
Object
- Object
- RubyNative::CLI::Preview
- Defined in:
- lib/ruby_native/cli/preview.rb
Constant Summary collapse
- TUNNEL_URL_PATTERN =
%r{https://[a-z0-9-]+\.trycloudflare\.com}- CONFIG_PATH =
"/native/config.json"- TUNNEL_READY_TIMEOUT =
60- TUNNEL_POLL_INTERVAL =
1- PUBLIC_NAMESERVERS =
["1.1.1.1", "8.8.8.8"].freeze
Instance Method Summary collapse
-
#initialize(argv) ⇒ Preview
constructor
A new instance of Preview.
- #run ⇒ Object
Constructor Details
#initialize(argv) ⇒ Preview
Returns a new instance of Preview.
15 16 17 18 19 |
# File 'lib/ruby_native/cli/preview.rb', line 15 def initialize(argv) @url = parse_option(argv, "--url") @port = parse_port(argv) @upstream = @url || "http://localhost:#{@port}" end |
Instance Method Details
#run ⇒ Object
21 22 23 24 25 |
# File 'lib/ruby_native/cli/preview.rb', line 21 def run check_cloudflared! check_upstream! start_tunnel end |