34
34
}
35
35
36
36
before :all do
37
- @default_bindir = RbConfig ::CONFIG [ 'bindir' ]
38
- @bin_dirs = [ RbConfig ::CONFIG [ 'bindir' ] ]
39
- @bin_dirs += RbConfig ::CONFIG [ 'extra_bindirs' ] . to_s . split ( File ::PATH_SEPARATOR ) if defined? ( ::TruffleRuby )
37
+ @bindir = RbConfig ::CONFIG [ 'bindir' ]
40
38
end
41
39
42
40
before :each do
@@ -76,7 +74,7 @@ def check_status_or_print(stdout_and_stderr)
76
74
end
77
75
78
76
it "is in the bindir" do
79
- File . dirname ( RbConfig . ruby ) . should == @default_bindir
77
+ File . dirname ( RbConfig . ruby ) . should == @bindir
80
78
end
81
79
82
80
it "all launchers are in @launchers" do
@@ -98,30 +96,26 @@ def check_status_or_print(stdout_and_stderr)
98
96
end
99
97
100
98
@launchers . each do |launcher , test |
101
- it "supports running #{ launcher } in any of the bin/ directories " do
99
+ it "supports running #{ launcher } in bin/" do
102
100
redirect = launcher == :erb ? ( touch @stderr ; '2>&1' ) : @redirect
103
- @bin_dirs . each do |bin_dir |
104
- out = `#{ bin_dir } /#{ launcher } --version #{ redirect } `
105
- check_status_and_empty_stderr
106
- out . should =~ test
107
- end
101
+ out = `#{ @bindir } /#{ launcher } --version #{ redirect } `
102
+ check_status_and_empty_stderr
103
+ out . should =~ test
108
104
end
109
105
end
110
106
111
107
@launchers . each do |launcher , test |
112
108
it "supports running #{ launcher } symlinked" do
113
109
redirect = launcher == :erb ? ( touch @stderr ; '2>&1' ) : @redirect
114
110
require 'tmpdir'
115
- @bin_dirs . each do |bin_dir |
116
- # Use the system tmp dir to not be under the Ruby home dir
117
- Dir . mktmpdir do |path |
118
- Dir . chdir ( path ) do
119
- linkname = "linkto#{ launcher } "
120
- File . symlink ( "#{ bin_dir } /#{ launcher } " , linkname )
121
- out = `./#{ linkname } --version #{ redirect } `
122
- check_status_and_empty_stderr
123
- out . should =~ test
124
- end
111
+ # Use the system tmp dir to not be under the Ruby home dir
112
+ Dir . mktmpdir do |path |
113
+ Dir . chdir ( path ) do
114
+ linkname = "linkto#{ launcher } "
115
+ File . symlink ( "#{ @bindir } /#{ launcher } " , linkname )
116
+ out = `./#{ linkname } --version #{ redirect } `
117
+ check_status_and_empty_stderr
118
+ out . should =~ test
125
119
end
126
120
end
127
121
end
@@ -130,35 +124,31 @@ def check_status_or_print(stdout_and_stderr)
130
124
it "for gem can install and uninstall the hello-world gem" do
131
125
# install
132
126
Dir . chdir ( __dir__ + '/fixtures/hello-world' ) do
133
- `"#{ @default_bindir } /gem" build hello-world.gemspec #{ @redirect } `
127
+ `"#{ @bindir } /gem" build hello-world.gemspec #{ @redirect } `
134
128
check_status_and_empty_stderr
135
- `"#{ @default_bindir } /gem" install --local hello-world-0.0.1.gem #{ @redirect } `
129
+ `"#{ @bindir } /gem" install --local hello-world-0.0.1.gem #{ @redirect } `
136
130
check_status_and_empty_stderr
137
131
end
138
132
139
133
begin
140
- # check that hello-world launchers are created and work
141
- @bin_dirs . each do |bin_dir |
142
- path = "#{ bin_dir } /hello-world.rb"
143
- shebang = File . binread ( path ) . lines . first . chomp
144
- if shebang . size > 127
145
- skip "shebang of #{ path } is too long and might fail in execve(): #{ shebang . size } \n #{ shebang } "
146
- end
147
- out = `#{ path } 2>&1`
148
- out . should == "Hello world! from #{ RUBY_DESCRIPTION } \n "
134
+ # check that hello-world launcher is created and works
135
+ path = "#{ @bindir } /hello-world.rb"
136
+ shebang = File . binread ( path ) . lines . first . chomp
137
+ if shebang . size > 127
138
+ skip "shebang of #{ path } is too long and might fail in execve(): #{ shebang . size } \n #{ shebang } "
149
139
end
140
+ out = `#{ path } 2>&1`
141
+ out . should == "Hello world! from #{ RUBY_DESCRIPTION } \n "
150
142
ensure
151
143
# uninstall
152
- `#{ @default_bindir } /gem uninstall hello-world -x #{ @redirect } `
144
+ `#{ @bindir } /gem uninstall hello-world -x #{ @redirect } `
153
145
check_status_and_empty_stderr
154
- @bin_dirs . each do |bin_dir |
155
- File . exist? ( bin_dir + '/hello-world.rb' ) . should == false
156
- end
146
+ File . should_not . exist? ( @bindir + '/hello-world.rb' )
157
147
end
158
148
end
159
149
160
150
it "for gem shows that bundled gems are installed" do
161
- gem_list = `#{ @default_bindir } /gem list #{ @redirect } `
151
+ gem_list = `#{ @bindir } /gem list #{ @redirect } `
162
152
check_status_and_empty_stderr
163
153
# see doc/contributor/stdlib.md
164
154
@bundled_gems . each_pair do |gem , version |
0 commit comments