localtunnel-restarter 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9d3e13aaf9c71d638a158f734411fff1b5731b11
4
- data.tar.gz: e80b1025196f3bebbabebf88055f8b6e0c30be75
3
+ metadata.gz: 5141b6b95b96de60ed3820c6c87cb7809eec2795
4
+ data.tar.gz: 036edd7534336681867f2062aa7001bf3cceb5a7
5
5
  SHA512:
6
- metadata.gz: 6c7a2917c5013c2dca83b5abb2dc41646fb53bed345270b9981c8f8007c7485e9b730635ff48f15e10999da6f293a23d6516f81efb5b9e05d50490f5444c1f58
7
- data.tar.gz: 6d8222fa9e4ee7d81112ecca2ed1033d2fca67102f280ad68d6693dc0ff31168a7f155f2525c0aa7345f2f67a3120aa3fee6e009d68619c5986229cdcdd4a85d
6
+ metadata.gz: 922c94eb0336640558101056d08d85b0683596e68b51f878891029b8eaa846b55c7abcbd01314390a7c769b3a853c1e00460ebad8d07edda332f7f5bd33a4938
7
+ data.tar.gz: 20d9f565f39d201d59bd10c3babc6092fdeb3957ebfffc8e3f5617c35e128fcc8685f4bbdc0a1247c45d54aea1c9feb99e7af9ae03cc232cd6ef2d80b679413a
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 Kirill Shevchenko
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.
@@ -0,0 +1,35 @@
1
+ # Localtunnel::Restarter
2
+
3
+ Command line tool which keeps localtunnel working
4
+
5
+ ## Installation
6
+
7
+ You need installed [localtunnel](//github.com/localtunnel/localtunnel) and ruby
8
+
9
+ install it yourself as:
10
+
11
+ $ gem install localtunnel-restarter
12
+
13
+ ## Usage
14
+
15
+ Type:
16
+
17
+ $ localtunnel-restarter --port 9292 --subdomain exampledomain
18
+
19
+ And use link https://exampledomain.localtunnel.me/
20
+
21
+ Or just with number port
22
+
23
+ $ localtunnel-restarter --port 8080
24
+
25
+ And link will be generated with random name
26
+
27
+ ## Contributing
28
+
29
+ Bug reports and pull requests are welcome on GitHub at https://github.com/kirillweb/localtunnel-restarter.
30
+
31
+
32
+ ## License
33
+
34
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
35
+
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+ task :default => :spec
@@ -0,0 +1,7 @@
1
+ require "localtunnel/restarter/version"
2
+ require "localtunnel/restarter/cli"
3
+
4
+ module Localtunnel
5
+ module Restarter
6
+ end
7
+ end
@@ -0,0 +1,59 @@
1
+ module Localtunnel
2
+ module Restarter
3
+ class CLI
4
+ def self.run
5
+ options = { subdomain: default_subdomain, port: nil }
6
+
7
+ parser = OptionParser.new do |opts|
8
+ opts.on('-s', '--subdomain subdomain', 'Subdomain') do |subdomain|
9
+ options[:subdomain] = subdomain;
10
+ end
11
+
12
+ opts.on('-p', '--port port', 'Port') do |port|
13
+ options[:port] = port;
14
+ end
15
+ end
16
+
17
+ parser.parse!
18
+
19
+ launch_count = 0
20
+
21
+ loop do
22
+ launch_count += 1
23
+ if options[:port]
24
+ p "Running localtunnel for the #{ordinalize(launch_count)} time"
25
+ `lt --port #{options[:port]} --subdomain #{options[:subdomain]}`
26
+ p "Link: https://#{options[:subdomain]}.localtunnel.me/"
27
+ else
28
+ p 'Option --port is required'
29
+ p 'Try to use something like this: localtunnel-restarter --port 9292'
30
+ exit
31
+ end
32
+ end
33
+ end
34
+
35
+ def self.ordinal(number)
36
+ abs_number = number.to_i.abs
37
+
38
+ if (11..13).include?(abs_number % 100)
39
+ 'th'
40
+ else
41
+ case abs_number % 10
42
+ when 1; 'st'
43
+ when 2; 'nd'
44
+ when 3; 'rd'
45
+ else 'th'
46
+ end
47
+ end
48
+ end
49
+
50
+ def self.ordinalize(number)
51
+ "#{number}#{ordinal(number)}"
52
+ end
53
+
54
+ def self.default_subdomain
55
+ (('a'..'z').map { |s| s } + (0..9).map { |n| n }).shuffle.join[0..9]
56
+ end
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,5 @@
1
+ module Localtunnel
2
+ module Restarter
3
+ VERSION = "0.1.1"
4
+ end
5
+ end
@@ -0,0 +1,20 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'localtunnel/restarter/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "localtunnel-restarter"
8
+ spec.version = Localtunnel::Restarter::VERSION
9
+ spec.authors = ["Kirill Shevchenko"]
10
+ spec.email = ["kirills167@gmail.com"]
11
+
12
+ spec.summary = "Command line tool which keeps localtunnel working"
13
+ spec.description = spec.summary
14
+ spec.homepage = "https://github.com/kirillweb"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0")
18
+ spec.executables = ["localtunnel-restarter"]
19
+ spec.require_paths = ["lib"]
20
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: localtunnel-restarter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kirill Shevchenko
@@ -18,7 +18,16 @@ executables:
18
18
  extensions: []
19
19
  extra_rdoc_files: []
20
20
  files:
21
+ - ".gitignore"
22
+ - Gemfile
23
+ - LICENSE.txt
24
+ - README.md
25
+ - Rakefile
21
26
  - bin/localtunnel-restarter
27
+ - lib/localtunnel/restarter.rb
28
+ - lib/localtunnel/restarter/cli.rb
29
+ - lib/localtunnel/restarter/version.rb
30
+ - localtunnel-restarter.gemspec
22
31
  homepage: https://github.com/kirillweb
23
32
  licenses:
24
33
  - MIT