meshchat 0.6.8 → 0.6.9

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: ceaf7ddcf414efc04b3a345133c273dc444c9448
4
- data.tar.gz: f09b11286a5b9cf649da3f550b3c1449a33dbba3
3
+ metadata.gz: 2f2e0fe21e401d973ec504f6fe5c2eeb5d4acff0
4
+ data.tar.gz: ca8adc64e30b1b166b1a55844b7bd8c9bdcd164e
5
5
  SHA512:
6
- metadata.gz: d0f60f33e20677a01decb769243b9f74d7eb485f97ff87c1eeb091e1f743f675f6a111042bb63f9eeafb624336cb476c155515d397933c015bf1248b03629cd8
7
- data.tar.gz: d75beae12aba45a0b2680f61b35d43d9ab2b4518759fd274533e474359474196c3001bbeaf5ea05b229c5b22e3ed43ef8bdde4050b94e64537add2edb63d109c
6
+ metadata.gz: f2cbab8677c041a77df0628a5337e2aa9b7d7344ce711dbfde64ef38a546ab0707e91e4ba323bd20a81050ea2dc4be008bf23ab612a871739bb886b408795fc9
7
+ data.tar.gz: 6d7b7dbbffd5836b1b92ea245a8256197d18eb3bd1c09a94d057e82c0ec641a0a3c1b4c2af301789cf6840d1c88a824e8314b095b44fc4ba14cdc7e393b75f90
@@ -12,6 +12,7 @@ require 'meshchat/command/exit'
12
12
  require 'meshchat/command/listen'
13
13
  require 'meshchat/command/stop_listening'
14
14
  require 'meshchat/command/help'
15
+ require 'meshchat/command/bind'
15
16
  require 'meshchat/command/online'
16
17
  require 'meshchat/command/offline'
17
18
  require 'meshchat/command/init'
@@ -41,7 +42,8 @@ module MeshChat
41
42
  MeshChat::Command::Base::EXPORT => MeshChat::Command::Share,
42
43
  MeshChat::Command::Base::ONLINE => MeshChat::Command::Offline,
43
44
  MeshChat::Command::Base::OFFLINE => MeshChat::Command::Online,
44
- MeshChat::Command::Base::HELP => MeshChat::Command::Help
45
+ MeshChat::Command::Base::HELP => MeshChat::Command::Help,
46
+ MeshChat::Command::Base::BIND => MeshChat::Command::Bind
45
47
  }
46
48
 
47
49
 
@@ -30,6 +30,7 @@ module MeshChat
30
30
  ONLINE = 'online'
31
31
  OFFLINE = 'offline'
32
32
  HELP = 'help'
33
+ BIND = 'bind'
33
34
 
34
35
  def handle
35
36
  klass = CLI::COMMAND_MAP[command]
@@ -0,0 +1,41 @@
1
+ require 'socket'
2
+ require 'open-uri'
3
+
4
+ module MeshChat
5
+ class Command
6
+ class Bind < Command::Base
7
+ def self.description
8
+ 'helper for choosing what ip address to use for yourself'
9
+ end
10
+
11
+ def handle
12
+ options = ip_addresses
13
+ option_numbers = []
14
+ Display.success 'Choose an ip:'
15
+ options.each_with_index do |ip, index|
16
+ Display.info "#{index}: #{ip}"
17
+ option_numbers << index
18
+ end
19
+
20
+ selected = MeshChat::CLI.get_input
21
+
22
+ if option_numbers.include?(selected.to_i)
23
+ Display.success Settings.set('ip', with: options[selected.to_i])
24
+ else
25
+ Display.alert 'Invalid selection'
26
+ handle # repeat
27
+ end
28
+
29
+
30
+ end
31
+
32
+ def ip_addresses
33
+ local = Socket.getifaddrs.map { |i| i.addr.ip_address if i.addr.ipv4? }.compact
34
+ # get public
35
+ remote_ip = open('http://whatismyip.akamai.com').read
36
+ local << remote_ip
37
+ local
38
+ end
39
+ end
40
+ end
41
+ end
@@ -10,7 +10,7 @@ module MeshChat
10
10
  msg = if list.present?
11
11
  list.join(", ")
12
12
  else
13
- 'no one is offline'
13
+ 'no one is online'
14
14
  end
15
15
 
16
16
  Display.info msg
@@ -1,3 +1,3 @@
1
1
  module MeshChat
2
- VERSION = '0.6.8'
2
+ VERSION = '0.6.9'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: meshchat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.8
4
+ version: 0.6.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - L. Preston Sego III
@@ -191,6 +191,7 @@ files:
191
191
  - lib/meshchat/cli/base.rb
192
192
  - lib/meshchat/cli/input.rb
193
193
  - lib/meshchat/command/base.rb
194
+ - lib/meshchat/command/bind.rb
194
195
  - lib/meshchat/command/config.rb
195
196
  - lib/meshchat/command/exit.rb
196
197
  - lib/meshchat/command/help.rb
@@ -260,5 +261,5 @@ rubyforge_project:
260
261
  rubygems_version: 2.4.8
261
262
  signing_key:
262
263
  specification_version: 4
263
- summary: MeshChat-0.6.8
264
+ summary: MeshChat-0.6.9
264
265
  test_files: []