wifi-wand 2.14.0 → 2.15.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 +4 -4
 - data/README.md +4 -12
 - data/RELEASE_NOTES.md +7 -0
 - data/lib/wifi-wand/command_line_interface.rb +8 -6
 - data/lib/wifi-wand/models/base_model.rb +12 -7
 - data/lib/wifi-wand/version.rb +1 -1
 - metadata +3 -4
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 51d32000847efd2e81288f34905ef2622d875d460b3f4bd3f3a823a7bfc53ff5
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 9a9bd05cac4003f148387c877a2e47cf37cea9fdd793cc848e3e5b01a6bc0887
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 6c82d035c66e289ff335f774313fde6a9bfec1bf403dc4f71f375d2ea825ebb12b0c265e27ee61361455466606ccfb898c9ab7588efde854a909f9bc1a023224
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: f75163a1ec497cf8010ddd28306cd4d1c621042c4af6e6835d55aeaad20f2751d8ad6c9f479c748fe26c65259d3c19015200612aa297349db3b59d4df0dcfb16
         
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -29,10 +29,7 @@ output at the time of this writing: 
     | 
|
| 
       29 
29 
     | 
    
         | 
| 
       30 
30 
     | 
    
         
             
            ```
         
     | 
| 
       31 
31 
     | 
    
         
             
            $ wifi-wand -h
         
     | 
| 
       32 
     | 
    
         
            -
             
     | 
| 
       33 
     | 
    
         
            -
            Syntax is: exe/wifi-wand [options] command [command_options]
         
     | 
| 
       34 
     | 
    
         
            -
             
     | 
| 
       35 
     | 
    
         
            -
            Command Line Switches:                    [wifi-wand version 2.13.0 at https://github.com/keithrbennett/wifiwand]
         
     | 
| 
      
 32 
     | 
    
         
            +
            Command Line Switches:                    [wifi-wand version 2.14.0 at https://github.com/keithrbennett/wifiwand]
         
     | 
| 
       36 
33 
     | 
    
         | 
| 
       37 
34 
     | 
    
         
             
            -o {i,j,k,p,y}            - outputs data in inspect, JSON, pretty JSON, puts, or YAML format when not in shell mode
         
     | 
| 
       38 
35 
     | 
    
         
             
            -p wifi_port_name         - override automatic detection of port name with this name
         
     | 
| 
         @@ -49,29 +46,24 @@ d[isconnect]              - disconnects from current network, does not turn off 
     | 
|
| 
       49 
46 
     | 
    
         
             
            f[orget] name1 [..name_n] - removes network-name(s) from the preferred networks list
         
     | 
| 
       50 
47 
     | 
    
         
             
            h[elp]                    - prints this help
         
     | 
| 
       51 
48 
     | 
    
         
             
            i[nfo]                    - a hash of wifi-related information
         
     | 
| 
       52 
     | 
    
         
            -
            l[s_avail_nets]           - details about available networks
         
     | 
| 
      
 49 
     | 
    
         
            +
            l[s_avail_nets]           - details about available networks in descending order of signal strength
         
     | 
| 
       53 
50 
     | 
    
         
             
            na[meservers]             - nameservers: 'show' or no arg to show, 'clear' to clear, or IP addresses to set, e.g. '9.9.9.9  8.8.8.8'
         
     | 
| 
       54 
51 
     | 
    
         
             
            ne[twork_name]            - name (SSID) of currently connected network
         
     | 
| 
       55 
52 
     | 
    
         
             
            on                        - turns wifi on
         
     | 
| 
       56 
53 
     | 
    
         
             
            of[f]                     - turns wifi off
         
     | 
| 
       57 
54 
     | 
    
         
             
            pa[ssword] network-name   - password for preferred network-name
         
     | 
| 
       58 
     | 
    
         
            -
            pr[ef_nets]               - preferred ( 
     | 
| 
      
 55 
     | 
    
         
            +
            pr[ef_nets]               - preferred (saved) networks
         
     | 
| 
       59 
56 
     | 
    
         
             
            q[uit]                    - exits this program (interactive shell mode only) (see also 'x')
         
     | 
| 
       60 
57 
     | 
    
         
             
            ro[pen]                   - open resource ('ipl' (IP Location), 'ipw' (What is My IP), 'spe' (Speed Test), 'this' (wifi-wand home page))
         
     | 
| 
       61 
58 
     | 
    
         
             
            t[ill]                    - returns when the desired Internet connection state is true. Options:
         
     | 
| 
       62 
59 
     | 
    
         
             
                                        1) 'on'/:on, 'off'/:off, 'conn'/:conn, or 'disc'/:disc
         
     | 
| 
       63 
     | 
    
         
            -
                                        2) wait interval, in seconds (optional, defaults to 0.5 seconds)
         
     | 
| 
      
 60 
     | 
    
         
            +
                                        2) wait interval between tests, in seconds (optional, defaults to 0.5 seconds)
         
     | 
| 
       64 
61 
     | 
    
         
             
            w[ifi_on]                 - is the wifi on?
         
     | 
| 
       65 
62 
     | 
    
         
             
            x[it]                     - exits this program (interactive shell mode only) (see also 'q')
         
     | 
| 
       66 
63 
     | 
    
         | 
| 
       67 
64 
     | 
    
         
             
            When in interactive shell mode:
         
     | 
| 
       68 
65 
     | 
    
         
             
              * remember to quote string literals.
         
     | 
| 
       69 
66 
     | 
    
         
             
              * for pry commands, use prefix `%`.
         
     | 
| 
       70 
     | 
    
         
            -
             
     | 
| 
       71 
     | 
    
         
            -
             
     | 
| 
       72 
     | 
    
         
            -
            When in interactive shell mode:
         
     | 
| 
       73 
     | 
    
         
            -
              * use quotes for string parameters such as method names.
         
     | 
| 
       74 
     | 
    
         
            -
              * for pry commands, use prefix `%`.
         
     | 
| 
       75 
67 
     | 
    
         
             
            ```
         
     | 
| 
       76 
68 
     | 
    
         | 
| 
       77 
69 
     | 
    
         
             
            Internally, it uses several Mac command line utilities to interact with the
         
     | 
    
        data/RELEASE_NOTES.md
    CHANGED
    
    | 
         @@ -1,3 +1,10 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ## v2.15.0
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            * Allow using symbols in the 'nameservers' subcommands.
         
     | 
| 
      
 4 
     | 
    
         
            +
            * Modify `forget` method to allow passing a single array of names, as returned by `pr.grep`, for example.
         
     | 
| 
      
 5 
     | 
    
         
            +
            * Output duration of http get's.
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
       1 
8 
     | 
    
         
             
            ## v2.14.0
         
     | 
| 
       2 
9 
     | 
    
         | 
| 
       3 
10 
     | 
    
         
             
            * `ls_avail_nets` command now outputs access points in signal strength order.
         
     | 
| 
         @@ -67,20 +67,22 @@ co[nnect] network-name    - turns wifi on, connects to network-name 
     | 
|
| 
       67 
67 
     | 
    
         
             
            cy[cle]                   - turns wifi off, then on, preserving network selection
         
     | 
| 
       68 
68 
     | 
    
         
             
            d[isconnect]              - disconnects from current network, does not turn off wifi
         
     | 
| 
       69 
69 
     | 
    
         
             
            f[orget] name1 [..name_n] - removes network-name(s) from the preferred networks list
         
     | 
| 
      
 70 
     | 
    
         
            +
                                        in interactive mode, can be a single array of names, e.g. returned by `pref_nets`
         
     | 
| 
       70 
71 
     | 
    
         
             
            h[elp]                    - prints this help
         
     | 
| 
       71 
72 
     | 
    
         
             
            i[nfo]                    - a hash of wifi-related information
         
     | 
| 
       72 
     | 
    
         
            -
            l[s_avail_nets]           - details about available networks
         
     | 
| 
       73 
     | 
    
         
            -
            na[meservers]             - nameservers: 'show' or no arg to show, 'clear' to clear, 
     | 
| 
      
 73 
     | 
    
         
            +
            l[s_avail_nets]           - details about available networks, in descending order of signal strength
         
     | 
| 
      
 74 
     | 
    
         
            +
            na[meservers]             - nameservers: 'show' or no arg to show, 'clear' to clear,
         
     | 
| 
      
 75 
     | 
    
         
            +
                                        or IP addresses to set, e.g. '9.9.9.9  8.8.8.8'
         
     | 
| 
       74 
76 
     | 
    
         
             
            ne[twork_name]            - name (SSID) of currently connected network
         
     | 
| 
       75 
77 
     | 
    
         
             
            on                        - turns wifi on
         
     | 
| 
       76 
78 
     | 
    
         
             
            of[f]                     - turns wifi off
         
     | 
| 
       77 
79 
     | 
    
         
             
            pa[ssword] network-name   - password for preferred network-name
         
     | 
| 
       78 
     | 
    
         
            -
            pr[ef_nets]               - preferred ( 
     | 
| 
      
 80 
     | 
    
         
            +
            pr[ef_nets]               - preferred (saved) networks
         
     | 
| 
       79 
81 
     | 
    
         
             
            q[uit]                    - exits this program (interactive shell mode only) (see also 'x')
         
     | 
| 
       80 
82 
     | 
    
         
             
            ro[pen]                   - open resource (#{OPEN_RESOURCES.help_string})
         
     | 
| 
       81 
83 
     | 
    
         
             
            t[ill]                    - returns when the desired Internet connection state is true. Options:
         
     | 
| 
       82 
84 
     | 
    
         
             
                                        1) 'on'/:on, 'off'/:off, 'conn'/:conn, or 'disc'/:disc
         
     | 
| 
       83 
     | 
    
         
            -
                                        2) wait interval, in seconds (optional, defaults to 0.5 seconds)
         
     | 
| 
      
 85 
     | 
    
         
            +
                                        2) wait interval between tests, in seconds (optional, defaults to 0.5 seconds)
         
     | 
| 
       84 
86 
     | 
    
         
             
            w[ifi_on]                 - is the wifi on?
         
     | 
| 
       85 
87 
     | 
    
         
             
            x[it]                     - exits this program (interactive shell mode only) (see also 'q')
         
     | 
| 
       86 
88 
     | 
    
         | 
| 
         @@ -330,9 +332,9 @@ When in interactive shell mode: 
     | 
|
| 
       330 
332 
     | 
    
         
             
              # Performs nameserver functionality.
         
     | 
| 
       331 
333 
     | 
    
         
             
              # @param subcommand 'get' or no arg to get, 'clear' to clear, and an array of IP addresses to set
         
     | 
| 
       332 
334 
     | 
    
         
             
              def cmd_na(*args)
         
     | 
| 
       333 
     | 
    
         
            -
                subcommand = if  
     | 
| 
      
 335 
     | 
    
         
            +
                subcommand = if args.empty? || args.first.to_sym == :get
         
     | 
| 
       334 
336 
     | 
    
         
             
                  :get
         
     | 
| 
       335 
     | 
    
         
            -
                elsif args ==  
     | 
| 
      
 337 
     | 
    
         
            +
                elsif args.first.to_sym == :clear
         
     | 
| 
       336 
338 
     | 
    
         
             
                  :clear
         
     | 
| 
       337 
339 
     | 
    
         
             
                else
         
     | 
| 
       338 
340 
     | 
    
         
             
                  :put
         
     | 
| 
         @@ -45,14 +45,14 @@ class BaseModel 
     | 
|
| 
       45 
45 
     | 
    
         | 
| 
       46 
46 
     | 
    
         
             
              def run_os_command(command, raise_on_error = true)
         
     | 
| 
       47 
47 
     | 
    
         | 
| 
       48 
     | 
    
         
            -
                if  
     | 
| 
      
 48 
     | 
    
         
            +
                if verbose_mode
         
     | 
| 
       49 
49 
     | 
    
         
             
                  puts CommandOutputFormatter.command_attempt_as_string(command)
         
     | 
| 
       50 
50 
     | 
    
         
             
                end
         
     | 
| 
       51 
51 
     | 
    
         | 
| 
       52 
52 
     | 
    
         
             
                start_time = Time.now
         
     | 
| 
       53 
53 
     | 
    
         
             
                output = `#{command} 2>&1` # join stderr with stdout
         
     | 
| 
       54 
54 
     | 
    
         | 
| 
       55 
     | 
    
         
            -
                if  
     | 
| 
      
 55 
     | 
    
         
            +
                if verbose_mode
         
     | 
| 
       56 
56 
     | 
    
         
             
                  puts "Duration: #{'%.4f' % [Time.now - start_time]} seconds"
         
     | 
| 
       57 
57 
     | 
    
         
             
                  puts CommandOutputFormatter.command_result_as_string(output)
         
     | 
| 
       58 
58 
     | 
    
         
             
                end
         
     | 
| 
         @@ -78,7 +78,7 @@ class BaseModel 
     | 
|
| 
       78 
78 
     | 
    
         
             
                # First pass to fail quickly if name resolving does not work.
         
     | 
| 
       79 
79 
     | 
    
         
             
                test_using_dig = -> do
         
     | 
| 
       80 
80 
     | 
    
         
             
                  domains = %w(google.com  baidu.com)
         
     | 
| 
       81 
     | 
    
         
            -
                  puts "Calling dig on domains #{domains}..." if  
     | 
| 
      
 81 
     | 
    
         
            +
                  puts "Calling dig on domains #{domains}..." if verbose_mode
         
     | 
| 
       82 
82 
     | 
    
         | 
| 
       83 
83 
     | 
    
         
             
                  threads = domains.map do |domain|
         
     | 
| 
       84 
84 
     | 
    
         
             
                    Thread.new do
         
     | 
| 
         @@ -90,13 +90,13 @@ class BaseModel 
     | 
|
| 
       90 
90 
     | 
    
         
             
                  threads.each(&:join)
         
     | 
| 
       91 
91 
     | 
    
         
             
                  values = threads.map(&:value)
         
     | 
| 
       92 
92 
     | 
    
         
             
                  success = values.include?(true)
         
     | 
| 
       93 
     | 
    
         
            -
                  puts "Results of dig: success == #{success}, values were #{values}." if  
     | 
| 
      
 93 
     | 
    
         
            +
                  puts "Results of dig: success == #{success}, values were #{values}." if verbose_mode
         
     | 
| 
       94 
94 
     | 
    
         
             
                  success
         
     | 
| 
       95 
95 
     | 
    
         
             
                end
         
     | 
| 
       96 
96 
     | 
    
         | 
| 
       97 
97 
     | 
    
         
             
                test_using_http_get = -> do
         
     | 
| 
       98 
98 
     | 
    
         
             
                  test_sites = %w{https://www.google.com  http://baidu.com}
         
     | 
| 
       99 
     | 
    
         
            -
                  puts "Calling HTTP.get on sites #{test_sites}..." if  
     | 
| 
      
 99 
     | 
    
         
            +
                  puts "Calling HTTP.get on sites #{test_sites}..." if verbose_mode
         
     | 
| 
       100 
100 
     | 
    
         | 
| 
       101 
101 
     | 
    
         
             
                  threads = test_sites.map do |site|
         
     | 
| 
       102 
102 
     | 
    
         
             
                    Thread.new do
         
     | 
| 
         @@ -105,8 +105,11 @@ class BaseModel 
     | 
|
| 
       105 
105 
     | 
    
         | 
| 
       106 
106 
     | 
    
         
             
                      begin
         
     | 
| 
       107 
107 
     | 
    
         
             
                        Net::HTTP.start(url.host) do |http|
         
     | 
| 
      
 108 
     | 
    
         
            +
                          start = Time.now
         
     | 
| 
       108 
109 
     | 
    
         
             
                          http.read_timeout = 3 # seconds
         
     | 
| 
       109 
110 
     | 
    
         
             
                          http.get('.')
         
     | 
| 
      
 111 
     | 
    
         
            +
                          duration = Time.now - start
         
     | 
| 
      
 112 
     | 
    
         
            +
                          puts "Finished HTTP get #{url.host} in #{duration} seconds" if verbose_mode
         
     | 
| 
       110 
113 
     | 
    
         
             
                        end
         
     | 
| 
       111 
114 
     | 
    
         
             
                      rescue
         
     | 
| 
       112 
115 
     | 
    
         
             
                        success = false
         
     | 
| 
         @@ -120,7 +123,7 @@ class BaseModel 
     | 
|
| 
       120 
123 
     | 
    
         
             
                  values = threads.map(&:value)
         
     | 
| 
       121 
124 
     | 
    
         
             
                  success = values.include?(true)
         
     | 
| 
       122 
125 
     | 
    
         | 
| 
       123 
     | 
    
         
            -
                  puts "Results of HTTP.get: success == #{success}, values were #{values}." if  
     | 
| 
      
 126 
     | 
    
         
            +
                  puts "Results of HTTP.get: success == #{success}, values were #{values}." if verbose_mode
         
     | 
| 
       124 
127 
     | 
    
         
             
                  success
         
     | 
| 
       125 
128 
     | 
    
         
             
                end
         
     | 
| 
       126 
129 
     | 
    
         | 
| 
         @@ -177,8 +180,10 @@ class BaseModel 
     | 
|
| 
       177 
180 
     | 
    
         | 
| 
       178 
181 
     | 
    
         
             
              # Removes the specified network(s) from the preferred network list.
         
     | 
| 
       179 
182 
     | 
    
         
             
              # @param network_names names of networks to remove; may be empty or contain nonexistent networks
         
     | 
| 
      
 183 
     | 
    
         
            +
              #        can be a single arg which is an array of names or 1 name string per arg
         
     | 
| 
       180 
184 
     | 
    
         
             
              # @return names of the networks that were removed (excludes non-preexisting networks)
         
     | 
| 
       181 
185 
     | 
    
         
             
              def remove_preferred_networks(*network_names)
         
     | 
| 
      
 186 
     | 
    
         
            +
                network_names = network_names.first if network_names.first.is_a?(Array) && network_names.size == 1
         
     | 
| 
       182 
187 
     | 
    
         
             
                networks_to_remove = network_names & preferred_networks # exclude any nonexistent networks
         
     | 
| 
       183 
188 
     | 
    
         
             
                networks_to_remove.each { |name| remove_preferred_network(name) }
         
     | 
| 
       184 
189 
     | 
    
         
             
              end
         
     | 
| 
         @@ -235,7 +240,7 @@ class BaseModel 
     | 
|
| 
       235 
240 
     | 
    
         
             
              def try_os_command_until(command, stop_condition, max_tries = 100)
         
     | 
| 
       236 
241 
     | 
    
         | 
| 
       237 
242 
     | 
    
         
             
                report_attempt_count = ->(attempt_count) do
         
     | 
| 
       238 
     | 
    
         
            -
                  puts "Command was executed #{attempt_count} time(s)." if  
     | 
| 
      
 243 
     | 
    
         
            +
                  puts "Command was executed #{attempt_count} time(s)." if verbose_mode
         
     | 
| 
       239 
244 
     | 
    
         
             
                end
         
     | 
| 
       240 
245 
     | 
    
         | 
| 
       241 
246 
     | 
    
         
             
                max_tries.times do |n|
         
     | 
    
        data/lib/wifi-wand/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: wifi-wand
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 2. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 2.15.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Keith Bennett
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: exe
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date:  
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2019-02-21 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: bundler
         
     | 
| 
         @@ -115,8 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       115 
115 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       116 
116 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       117 
117 
     | 
    
         
             
            requirements: []
         
     | 
| 
       118 
     | 
    
         
            -
             
     | 
| 
       119 
     | 
    
         
            -
            rubygems_version: 2.7.7
         
     | 
| 
      
 118 
     | 
    
         
            +
            rubygems_version: 3.0.2
         
     | 
| 
       120 
119 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       121 
120 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       122 
121 
     | 
    
         
             
            summary: Mac WiFi utility
         
     |