whee 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/whee.rb +39 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 31d6c5100e2dcd46a7afcafc93f89c54431fd52b823b5b22a9ba7d095758c97d
|
4
|
+
data.tar.gz: 4aef7eb4bdb25cccafc333453ecf21863466e659096c627ab40f8e14b4b30237
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5ceb0010433f37a430e941479d23c2b570647aa55264af7bf4e6b6fe253a6b32a69ed50478d227e757388154efa0109a5f23dac4ad8a1d79803ede9ca4cf7705
|
7
|
+
data.tar.gz: e6858ec92921d0a36e7e78628b8b8a282a84374ee8654de1805fe4f5db69ad97a520e64eaf8bd1a3845c623852f56f6869c800288b61b8e958cd6b09726c71ad
|
data/lib/whee.rb
CHANGED
@@ -25,10 +25,47 @@ class Main
|
|
25
25
|
end.parse!(into: @@options)
|
26
26
|
end
|
27
27
|
|
28
|
+
# checks whether current directory is a wpilib project
|
29
|
+
def wpilib_proj?
|
30
|
+
File.exist?(".\\.wpilib\\wpilib_preferences.json")
|
31
|
+
end
|
32
|
+
|
33
|
+
# sets default options based on ./.wpilib/wpilib_preferences.json
|
34
|
+
def wpilib_pref
|
35
|
+
require 'json'
|
36
|
+
|
37
|
+
# no error checking because this method is only called after `wpilib_proj?`
|
38
|
+
preferences = JSON.parse(File.read(".\\.wpilib\\wpilib_preferences.json"))
|
39
|
+
|
40
|
+
@@options[:year] = preferences["projectYear"]
|
41
|
+
@@options[:team] = preferences["teamNumber"]
|
42
|
+
end
|
43
|
+
|
44
|
+
# refresh list of networks available
|
45
|
+
def netsh_refresh
|
46
|
+
# disconnect from current to force refresh
|
47
|
+
%x(netsh wlan disconnect)
|
48
|
+
|
49
|
+
# sleep until refresh
|
50
|
+
sleep 3
|
51
|
+
end
|
52
|
+
|
28
53
|
def run
|
54
|
+
# ensure wpilib project
|
55
|
+
if !wpilib_proj?
|
56
|
+
puts "File '.\\.wpilib\\wpilib_preferences.json' not found."
|
57
|
+
exit(1)
|
58
|
+
else
|
59
|
+
# set options from wpilib proj
|
60
|
+
wpilib_pref
|
61
|
+
end
|
62
|
+
|
29
63
|
# run command line options parser
|
30
64
|
parse_options
|
31
65
|
|
66
|
+
# refresh list of networks
|
67
|
+
netsh_refresh
|
68
|
+
|
32
69
|
# output of netsh
|
33
70
|
networks = %x(netsh wlan show networks).lines.filter do |line|
|
34
71
|
# check if line is a network ssid
|
@@ -60,7 +97,7 @@ class Main
|
|
60
97
|
# exit if no robot network to connect to
|
61
98
|
if networks.empty?
|
62
99
|
puts "No robot network found to connect to."
|
63
|
-
exit(
|
100
|
+
exit(1)
|
64
101
|
end
|
65
102
|
|
66
103
|
# index of desired network
|
@@ -103,7 +140,7 @@ class Main
|
|
103
140
|
end
|
104
141
|
|
105
142
|
# year for jdk location
|
106
|
-
year =
|
143
|
+
year = @@options[:year] || Time.now.year.to_s
|
107
144
|
dir = "C:\\Users\\Public\\wpilib\\#{year}\\jdk"
|
108
145
|
|
109
146
|
# check if jdk exists
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: whee
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ell Torek
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-05-
|
11
|
+
date: 2022-05-27 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |2
|
14
14
|
whee is a command-line program to accelerate the GradleRIO deploy process used in the
|