Skip to content

Commit bb774b2

Browse files
committed
Fix CircleCI
1 parent 7a53461 commit bb774b2

File tree

4 files changed

+32
-34
lines changed

4 files changed

+32
-34
lines changed

.circleci/config.yml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,31 +10,25 @@ references:
1010
jobs:
1111
"ruby-2-5":
1212
docker:
13-
- image: 'cimg/base:stable'
13+
- image: circleci/ruby:2.5
1414
steps:
1515
- checkout
16-
- ruby/install:
17-
version: "2.5"
1816
- ruby/install-deps
1917
- <<: *unit
2018

2119
"ruby-2-6":
2220
docker:
23-
- image: 'cimg/base:stable'
21+
- image: circleci/ruby:2.6
2422
steps:
2523
- checkout
26-
- ruby/install:
27-
version: "2.6"
2824
- ruby/install-deps
2925
- <<: *unit
3026

3127
"ruby-2-7":
3228
docker:
33-
- image: 'cimg/base:stable'
29+
- image: circleci/ruby:2.7
3430
steps:
3531
- checkout
36-
- ruby/install:
37-
version: "2.7"
3832
- ruby/install-deps
3933
- <<: *unit
4034

lib/syntax_search.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ def self.handle_error(e, search_source_on_error: SEARCH_SOURCE_ON_ERROR_DEFAULT)
1616

1717
filename = e.message.split(":").first
1818

19+
$stderr.sync = true
1920
$stderr.puts "Run `$ syntax_search #{filename}` for more options\n"
2021

2122
if search_source_on_error

spec/unit/exe_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def exe(cmd)
1515
it "parses valid code" do
1616
ruby_file = exe_path
1717
out = exe(ruby_file)
18-
expect(out.strip).to eq("Syntax OK")
18+
expect(out.strip).to include("Syntax OK")
1919
end
2020

2121
it "parses invalid code" do

spec/unit/syntax_search_spec.rb

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,13 @@ def run_ruby(script)
4646
dir = Pathname(dir)
4747
gemfile = dir.join("Gemfile")
4848
gemfile.write(<<~EOM)
49+
source "https://rubygems.org"
4950
gem "syntax_search", path: "#{root_dir}", require: "syntax_search/auto"
5051
EOM
51-
run!("BUNDLE_GEMFILE=#{gemfile} bundle install --local")
52+
dir.join("Gemfile.lock").write(root_dir.join("Gemfile.lock").read)
53+
out = run!("BUNDLE_GEMFILE=#{gemfile} bundle install")
54+
puts out
55+
5256
script = dir.join("script.rb")
5357
script.write <<~EOM
5458
describe "things" do
@@ -63,20 +67,18 @@ def run_ruby(script)
6367
end
6468
EOM
6569

66-
Bundler.with_original_env do
67-
require_rb = dir.join("require.rb")
68-
require_rb.write <<~EOM
69-
Bundler.require
70+
require_rb = dir.join("require.rb")
71+
require_rb.write <<~EOM
72+
Bundler.require
7073
71-
require_relative "./script.rb"
72-
EOM
74+
require_relative "./script.rb"
75+
EOM
7376

74-
out = `BUNDLE_GEMFILE=#{gemfile} bundle exec ruby #{require_rb} 2>&1`
77+
out = `BUNDLE_GEMFILE=#{gemfile} bundle exec ruby #{require_rb} 2>&1`
7578

76-
expect($?.success?).to be_falsey
77-
expect(out).to include("This code has an unmatched")
78-
expect(out).to include("Run `$ syntax_search")
79-
end
79+
expect($?.success?).to be_falsey
80+
expect(out).to include("This code has an unmatched")
81+
expect(out).to include("Run `$ syntax_search")
8082
end
8183
end
8284

@@ -85,9 +87,12 @@ def run_ruby(script)
8587
dir = Pathname(dir)
8688
gemfile = dir.join("Gemfile")
8789
gemfile.write(<<~EOM)
90+
source "https://rubygems.org"
8891
gem "syntax_search", path: "#{root_dir}", require: "syntax_search/fyi"
8992
EOM
90-
run!("BUNDLE_GEMFILE=#{gemfile} bundle install --local")
93+
out = run!("BUNDLE_GEMFILE=#{gemfile} bundle install")
94+
puts out
95+
9196
script = dir.join("script.rb")
9297
script.write <<~EOM
9398
describe "things" do
@@ -102,20 +107,18 @@ def run_ruby(script)
102107
end
103108
EOM
104109

105-
Bundler.with_original_env do
106-
require_rb = dir.join("require.rb")
107-
require_rb.write <<~EOM
108-
Bundler.require
110+
require_rb = dir.join("require.rb")
111+
require_rb.write <<~EOM
112+
Bundler.require
109113
110-
require_relative "./script.rb"
111-
EOM
114+
require_relative "./script.rb"
115+
EOM
112116

113-
out = `BUNDLE_GEMFILE=#{gemfile} bundle exec ruby #{require_rb} 2>&1`
117+
out = `BUNDLE_GEMFILE=#{gemfile} bundle exec ruby #{require_rb} 2>&1`
114118

115-
expect($?.success?).to be_falsey
116-
expect(out).to_not include("This code has an unmatched")
117-
expect(out).to include("Run `$ syntax_search")
118-
end
119+
expect($?.success?).to be_falsey
120+
expect(out).to_not include("This code has an unmatched")
121+
expect(out).to include("Run `$ syntax_search")
119122
end
120123
end
121124
end

0 commit comments

Comments
 (0)