whee 0.1.0 → 0.1.1

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -1
  3. data/lib/whee.rb +27 -15
  4. metadata +9 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5bcc44010a78f03c0ce36daecdde822f0bd1fb69d8ca26654bbeee694825df0c
4
- data.tar.gz: 0ad36cca810c1a98f934ad89b71b3b33ad0041c31dffb38cf36f0090eecd1e36
3
+ metadata.gz: ae47499005066bd2f7972e45d154d2cc7aee5825f7d642577a5b4632064aba6e
4
+ data.tar.gz: '08dcfa8319fe3e17b3cc8474a72ed83f11d6cb98276350fe3ac3691954ebb9a3'
5
5
  SHA512:
6
- metadata.gz: 8cd8162f0619ad79d042c41c1e6b19af13b52e483d276e2ed10b96ad9e3de9d2170f196d6a438c314988320458b472fc5d11208cf732b98e5a425d84cac85023
7
- data.tar.gz: cf0401b0179e7a48cb9014ea76c21a63df325891fe70be23188989d38c2725bc59507d5f56fe6d6575497c25e7c85eb560f29d8ed63e30ab0338fdc1f084d4ec
6
+ metadata.gz: 89ebc82e7fb75d08d7708a457c29eda5c71df00b50f97ad7a0d87c72fe38ff08acecc88788f73b7600539ecf16aa226c1b6fdf8877a512a3b829c2ec9bbe4541
7
+ data.tar.gz: ef5679070676f46b80322ff90cfc664d06fca61d6a0b102f97e47691cae5e7bf0865c06b6782bf2c576c21cb3134c98043f0ef7baf57c069b8db65b0d64a600e
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # whee
2
2
 
3
- a faster deploy tool for FRC
3
+ whee is a command-line program to accelerate the GradleRIO deploy process used in the FIRST Robotics Competition. It automatically connects to available robot WiFi networks and deploys code.
4
+
5
+ > whee is still largely untested and is not approved or endorsed by FIRST in any way.
4
6
 
5
7
  ### known issues
6
8
 
data/lib/whee.rb CHANGED
@@ -5,26 +5,24 @@ class Main
5
5
  @@options = {
6
6
  :team => nil,
7
7
  :name => nil,
8
- :year => nil
8
+ :year => nil,
9
+ :connect => false
9
10
  }
10
11
 
11
12
  def parse_options
12
13
  OptionParser.new do |opts|
13
14
  # team number
14
- opts.on("-t", "--team=TEAM", Integer, "Team number to connect to") do |team|
15
- @@options[:team] = team
16
- end
15
+ opts.on("-t", "--team=TEAM", Integer, "Team number to connect to")
17
16
 
18
17
  # network name
19
- opts.on("-n", "--name=NAME", String, "Network name excluding team number") do |name|
20
- @@options[:name] = name.strip
21
- end
18
+ opts.on("-n", "--name=NAME", String, "Network name excluding team number")
22
19
 
23
20
  # year for wpilib jdk
24
- opts.on("-y", "--year=YEAR", Integer, "WPILib version to use JDK from") do |year|
25
- @@options[:year] = year
26
- end
27
- end.parse!
21
+ opts.on("-y", "--year=YEAR", Integer, "WPILib version to use JDK from")
22
+
23
+ # only connect to robot
24
+ opts.on("-c", "--connect", "Only connect and not deploy")
25
+ end.parse!(into: @@options)
28
26
  end
29
27
 
30
28
  def run
@@ -51,7 +49,7 @@ class Main
51
49
 
52
50
  # team and name are set by options if present otherwise default regex
53
51
  team = (@@options[:team].nil?) ? '^[\d]{3,4}' : "^(#{@@options[:team].to_s[0..3]})"
54
- name = (@@options[:name].nil?) ? '[\w]*$' : "_(#{@@options[:name]})$"
52
+ name = (@@options[:name].nil?) ? '[\w]*$' : "_(#{@@options[:name].strip})$"
55
53
  frc_regexp = Regexp.new(team + name)
56
54
 
57
55
  # check which networks match the frc radio name regex
@@ -94,13 +92,28 @@ class Main
94
92
 
95
93
  if !error
96
94
  puts "Successfully connected to robot network."
95
+
96
+ # exit if connect-only mode is set
97
+ if @@options[:connect]
98
+ exit(0)
99
+ end
97
100
  else
98
101
  puts "Failed to connect to robot network."
99
102
  exit(1)
100
103
  end
101
104
 
102
- # set jdk home for gradle wrapper
103
- ENV['JAVA_HOME'] = "C:\\Users\\Public\\wpilib\\#{Time.now.year.to_s}\\jdk"
105
+ # year for jdk location
106
+ year = (@@options[:year].nil?) ? Time.now.year.to_s : @@options[:year]
107
+ dir = "C:\\Users\\Public\\wpilib\\#{year}\\jdk"
108
+
109
+ # check if jdk exists
110
+ if !Dir.exists?(dir)
111
+ puts "Invalid year provided. JDK not found."
112
+ exit(1)
113
+ end
114
+
115
+ # set gradle wrapper java home
116
+ ENV['JAVA_HOME'] = dir
104
117
 
105
118
  # run gradle deploy
106
119
  begin
@@ -113,7 +126,6 @@ class Main
113
126
  end
114
127
 
115
128
  puts deploy
116
- puts %x(echo %ERRORLEVEL%)
117
129
  end
118
130
  end
119
131
 
metadata CHANGED
@@ -1,16 +1,21 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: whee
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
  - Ell Torek
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-05-22 00:00:00.000000000 Z
11
+ date: 2022-05-25 00:00:00.000000000 Z
12
12
  dependencies: []
13
- description:
13
+ description: |2
14
+ whee is a command-line program to accelerate the GradleRIO deploy process used in the
15
+ FIRST Robotics Competition. It automatically connects to available robot WiFi networks
16
+ and deploys code.
17
+
18
+ whee is still largely untested and is not approved or endorsed by FIRST in any way.
14
19
  email: ctorek@proton.me
15
20
  executables:
16
21
  - whee
@@ -33,7 +38,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
33
38
  requirements:
34
39
  - - ">="
35
40
  - !ruby/object:Gem::Version
36
- version: '0'
41
+ version: 2.7.0
37
42
  required_rubygems_version: !ruby/object:Gem::Requirement
38
43
  requirements:
39
44
  - - ">="