File tree 9 files changed +17
-26
lines changed
9 files changed +17
-26
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
24
24
- Referring to an undefined platform no longer causes a crash; it's now a helpful error message
25
25
- A copy/paste error that prevented compiler warning flags from being supplied has been fixed, via jgfoster
26
26
- RSpec was not communicating compile errors from unit test executables that failed to build. Now it does, via jgfoster
27
+ - Windows paths now avoid picking up backslashes, for proper equality comparisons
27
28
28
29
### Security
29
30
Original file line number Diff line number Diff line change @@ -90,7 +90,9 @@ def config_dump
90
90
91
91
# @return [String] the path to the Arduino libraries directory
92
92
def lib_dir
93
- Pathname . new ( config_dump [ "directories" ] [ "user" ] ) + "libraries"
93
+ user_dir_raw = config_dump [ "directories" ] [ "user" ]
94
+ user_dir = OS . windows? ? Host . windows_to_pathname ( user_dir_raw ) : user_dir_raw
95
+ Pathname . new ( user_dir ) + "libraries"
94
96
end
95
97
96
98
# Board manager URLs
Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ def self.autolocated_executable
43
43
# The executable Arduino file in an existing installation, or nil
44
44
# @return [Pathname]
45
45
def self . existing_executable
46
- self . must_implement ( __method__ )
46
+ Host . which ( "arduino-cli" )
47
47
end
48
48
49
49
# The local file (dir) name of the desired IDE package (zip/tar/etc)
Original file line number Diff line number Diff line change @@ -17,12 +17,6 @@ def self.extracted_file
17
17
"arduino-cli"
18
18
end
19
19
20
- # The executable Arduino file in an existing installation, or nil
21
- # @return [string]
22
- def self . existing_executable
23
- Host . which ( "arduino-cli" )
24
- end
25
-
26
20
# Make any preparations or run any checks prior to making changes
27
21
# @return [string] Error message, or nil if success
28
22
def prepare
Original file line number Diff line number Diff line change @@ -17,12 +17,6 @@ def self.extracted_file
17
17
"arduino-cli"
18
18
end
19
19
20
- # The executable Arduino file in an existing installation, or nil
21
- # @return [string]
22
- def self . existing_executable
23
- Host . which ( "arduino-cli" )
24
- end
25
-
26
20
# Make any preparations or run any checks prior to making changes
27
21
# @return [string] Error message, or nil if success
28
22
def prepare
Original file line number Diff line number Diff line change @@ -28,12 +28,6 @@ def package_file
28
28
"arduino-cli_#{ @desired_version } _Windows_64bit.zip"
29
29
end
30
30
31
- # The executable Arduino file in an existing installation, or nil
32
- # @return [string]
33
- def self . existing_executable
34
- Host . which ( "arduino-cli" )
35
- end
36
-
37
31
# The technology that will be used to extract the download
38
32
# (for logging purposes)
39
33
# @return [string]
@@ -57,5 +51,11 @@ def self.extracted_file
57
51
"arduino-cli.exe"
58
52
end
59
53
54
+ # The executable Arduino file in a forced installation, or nil
55
+ # @return [Pathname]
56
+ def self . force_installed_executable
57
+ Pathname . new ( Host . windows_to_pathname ( ENV [ 'HOME' ] ) ) + self . extracted_file
58
+ end
59
+
60
60
end
61
61
end
Original file line number Diff line number Diff line change @@ -17,13 +17,14 @@ class Host
17
17
# via https://stackoverflow.com/a/5471032/2063546
18
18
# which('ruby') #=> /usr/bin/ruby
19
19
# @param cmd [String] the command to search for
20
- # @return [String ] the full path to the command if it exists
20
+ # @return [Pathname ] the full path to the command if it exists
21
21
def self . which ( cmd )
22
22
exts = ENV [ 'PATHEXT' ] ? ENV [ 'PATHEXT' ] . split ( ';' ) : [ '' ]
23
- ENV [ 'PATH' ] . split ( File ::PATH_SEPARATOR ) . each do |path |
23
+ ENV [ 'PATH' ] . split ( File ::PATH_SEPARATOR ) . each do |string_path |
24
+ path = OS . windows? ? windows_to_pathname ( string_path ) : Pathname . new ( string_path )
24
25
exts . each do |ext |
25
- exe = File . join ( path , "#{ cmd } #{ ext } " )
26
- return exe if File . executable? ( exe ) && !File . directory? ( exe )
26
+ exe = path . join ( "#{ cmd } #{ ext } " )
27
+ return exe if exe . executable? && !exe . directory?
27
28
end
28
29
end
29
30
nil
Original file line number Diff line number Diff line change 7
7
it "has correct class properties" do
8
8
ad = ArduinoCI ::ArduinoDownloader
9
9
10
- expect { ad . existing_executable } . to raise_error ( NotImplementedError )
11
10
expect { ad . extracted_file } . to raise_error ( NotImplementedError )
12
11
expect { ad . extracter } . to raise_error ( NotImplementedError )
13
12
expect { ad . extract ( "foo" ) } . to raise_error ( NotImplementedError )
Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ def with_tmpdir(path)
54
54
it "can find things with which" do
55
55
ruby_path = ArduinoCI ::Host . which ( "ruby" )
56
56
expect ( ruby_path ) . not_to be nil
57
- expect ( ruby_path . include? "ruby" ) . to be true
57
+ expect ( ruby_path . to_s . include? "ruby" ) . to be true
58
58
end
59
59
end
60
60
You can’t perform that action at this time.
0 commit comments