Skip to content
This repository was archived by the owner on Oct 14, 2020. It is now read-only.

Commit 6b55010

Browse files
committed
- updated readme with latest version and project mode info
- started to migrate to 2 space indents - sql now has a try_connection method to allow other code to be wrapped with it
1 parent 0543f16 commit 6b55010

File tree

6 files changed

+247
-259
lines changed

6 files changed

+247
-259
lines changed

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ root = true
33
[*]
44
charset = utf-8
55
indent_style = space
6-
indent_size = 4
6+
indent_size = 2
77
end_of_line = lf
88
insert_final_newline = true
99
trim_trailing_whitespace = true

README.md

Lines changed: 44 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -70,49 +70,50 @@ Many languages are currently supported in various states of completeness. This l
7070

7171
**Legend:** `!!!` = Failing Specs, `???` = Status is unknown, `*` = Any
7272

73-
| Language | Version | Basic Run | Test Integration | Codewars | Qualified | Docker Image | Examples | Notes |
74-
|----------------|---------------|--------------|------------------|---------------|----------------|----------------|--------------|-------------------------------------------------------------------------|
75-
| Assembly (GAS) | | !!! | | | | systems-runner | | Travis is failing, tests pass locally |
76-
| Bash | || | Kumite Only | | * | | |
77-
| C | Clang 3.6/C11 || criterion | criterion | | systems-runner | | |
78-
| Clojure | 1.6.0 || clojure.test | clojure.test | clojure.test | jvm-runner | clojure.test | |
79-
| CoffeeScript | 1.10.0 || cw-2 | cw-2 | cw-2 | node-runner | cw-2 | |
80-
| C++ | 14 || igloo | igloo | | systems-runner | | |
81-
| C# | Mono 4.8 || nunit | nunit | nunit | dotnet-runner | nunit | |
82-
| Crystal | 0.21.1 || spec | spec | spec | crystal-runner | spec | |
83-
| Dart | 1.16.1 || test | Kumite Only | | dart-runner | test | |
84-
| Elixir | 1.2.4 || exunit | exunit | | erlang-runner | | |
85-
| Erlang | 18 || | | | erlang-runner | | |
86-
| F# | 4.0 || fuchu | fuchu | | dotnet-runner | Fuchu | Tests should be placed in a module called "Tests", in a Fuchu testList |
87-
| Go | 1.3.1 || | Kumite Only | | alt-runner | | |
88-
| Groovy | || | Kumite Only | | jvm-runner | | |
89-
| Haskell | 7.6.3 || hspec!!! | hspec | hspec | haskell-runner | hspec | An older version is running on CW & Qualified that is fully functional |
90-
| Java | 1.8.0_91 || junit | Yes | Yes | jvm-runner | junit | |
91-
| JavaScript | 0.10.33 || cw-2, mocha | cw-2 | cw-2, mocha | node-runner | cw-2 | |
92-
| JavaScript | 0.10.33/Babel || cw-2, mocha | cw-2 | cw-2, mocha | node-runner | cw-2 | |
93-
| JavaScript | 6.0.0 || cw-2, mocha | cw-2 | cw-2, mocha | node-runner | cw-2 | |
94-
| JavaScript | 6.0.0/Babel || cw-2, mocha | cw-2 | cw-2, mocha | node-runner | cw-2 | |
95-
| Julia | 0.4.6 || factcheck | factcheck | | | | |
96-
| Kotlin | 1.0.3 || ??? | | | jvm-runner | | |
97-
| Lisp | || | Kumite Only | | func-runner | | |
98-
| Lua | || | Kumite Only | | alt-runner | | |
99-
| Objective-C | 2.0 || cw | cw | | objc-runner | | |
100-
| OCAML | 4.02.3 || ounit | ounit | | ocaml-runner | | Tests should be placed in a module called "Tests", in an array of OUnit labels named "suite" |
101-
| Perl | || | Kumite Only | | * | | |
102-
| Php | 7.0 || cw-2, phpunit | phpunit | phpunit, cw-2 | alt-runner | | |
103-
| Python | 2.7.6 || cw-2, unittest | cw-2 | cw-2, unittest | python-runner | cw-2 | |
104-
| Python | 3.4.3 || cw-2, unittest | | cw-2, unittest | python-runner | cw-2 | |
105-
| R | || | | | alt-runner | | |
106-
| Racket | || | Kumite Only | | func-runner | | |
107-
| Ruby | 2.3.0 || cw-2, rspec | cw-2 | cw-2, rspec | ruby-runner | cw-2 | |
108-
| Rust | 1.10.0 || rust | rust | | | | |
109-
| Scala | 2.11.2 || | Kumite Only | | jvm-runner | | |
110-
| Scss/Sass | | ??? | ??? | | | | | |
111-
| SQL | SQLite3 || rspec | | | | | Current contribution designed for OSX, need to move to OS linux version |
112-
| SQL | Postgres 9.6 || rspec | | | | | Current contribution designed for OSX, need to move to OS linux version |
113-
| Swift | 3.0-dev || cw-2, xctest | xctest | | | | Current contribution designed for OSX, need to move to OS linux version |
114-
| TypeScript | 1.8.10 || mocha | mocha | | node-runner | | TypeScript utilizes `require` instead of concatenating files |
115-
73+
| Language | Version | Basic Run | Project Mode | Test Integration | Codewars | Qualified | Docker Image | Examples | Notes |
74+
|----------------|---------------|------------|--------------|------------------|----------------|----------------|--------------|---------------| ------------------------------------------------------------------------|
75+
| Assembly (GAS) | | !!! | | | | | systems-runner | | Travis is failing, tests pass locally |
76+
| Bash | ||| | Kumite Only | | * | | |
77+
| C | Clang 3.6/C11 || | criterion | criterion | | systems-runner | | |
78+
| Clojure | 1.6.0 || | clojure.test | clojure.test | clojure.test | jvm-runner | clojure.test | |
79+
| CoffeeScript | 1.10.0 || | cw-2 | cw-2 | cw-2 | node-runner | cw-2 | |
80+
| C++ | 14 || | igloo | igloo | | systems-runner | | |
81+
| C# | Mono 4.8 ||| nunit | nunit | nunit | dotnet-runner | nunit | |
82+
| Crystal | 0.21.1 || | spec | spec | spec | crystal-runner | spec | |
83+
| Dart | 1.16.1 || | test | Kumite Only | | dart-runner | test | |
84+
| Elixir | 1.2.4 || | exunit | exunit | | erlang-runner | | |
85+
| Erlang | 18 || | | | | erlang-runner | | |
86+
| F# | 4.0 || | fuchu | fuchu | | dotnet-runner | Fuchu | Tests should be placed in a module called "Tests", in a Fuchu testList |
87+
| Go | 1.8 || | ginkgo | ginkgo | | go-runner | ginkgo | |
88+
| Groovy | || | | Kumite Only | | jvm-runner | | |
89+
| Haskell | 7.6.3 || | hspec!!! | hspec | hspec | haskell-runner | hspec | An older version is running on CW & Qualified that is fully functional |
90+
| Java | 1.8.0_91 || | junit | Yes | Yes | jvm-runner | junit | |
91+
| JavaScript | 0.10.33 ||| cw-2 | cw-2 | cw-2, | node-runner | cw-2 | |
92+
| JavaScript | 0.10.33/Babel ||| cw-2 | cw-2 | cw-2, | node-runner | cw-2 | |
93+
| JavaScript | 6.0.0 ||| cw-2, mocha | cw-2 | cw-2, mocha | node-runner | cw-2 | |
94+
| JavaScript | 6.0.0/Babel ||| cw-2, mocha | cw-2 | cw-2, mocha | node-runner | cw-2 | |
95+
| Julia | 0.4.6 || | factcheck | factcheck | | | | |
96+
| Kotlin | 1.0.3 || | ??? | | | jvm-runner | | |
97+
| Lisp | || | | Kumite Only | | func-runner | | |
98+
| Lua | 5.2 || | busted | busted | | lua-runner | | |
99+
| Objective-C | 2.0 || | cw | cw | | objc-runner | | |
100+
| OCAML | 4.02.3 || | ounit | ounit | | ocaml-runner | | Tests should be placed in a module called "Tests", in an array of OUnit labels named "suite" |
101+
| Perl | || | | Kumite Only | | * | | |
102+
| Php | 7.0 || | cw-2, phpunit | phpunit | phpunit, cw-2 | alt-runner | | |
103+
| Python | 2.7.6 ||| cw-2, unittest | cw-2 | cw-2, unittest | python-runner | cw-2 | |
104+
| Python | 3.4.3 ||| cw-2, unittest | | cw-2, unittest | python-runner | cw-2 | |
105+
| Python | 3.6 ||| cw-2, unittest | | cw-2, unittest | python-runner | cw-2 | |
106+
| R | || | | | | alt-runner | | |
107+
| Racket | || | | Kumite Only | | func-runner | | |
108+
| Ruby | 2.3.0 ||| cw-2, rspec | cw-2 | cw-2, rspec | ruby-runner | cw-2 | |
109+
| Rust | 1.10.0 || | rust | rust | | | | |
110+
| Scala | 2.11.2 || | | Kumite Only | | jvm-runner | | |
111+
| Scss/Sass | | ??? | | ??? | | | | | |
112+
| SQL | SQLite3 ||| rspec | | | | | Current contribution designed for OSX, need to move to OS linux version |
113+
| SQL | Postgres 9.6 ||| rspec | | | | | Current contribution designed for OSX, need to move to OS linux version |
114+
| Swift | 3.0-dev || | cw-2, xctest | xctest | | | | Current contribution designed for OSX, need to move to OS linux version |
115+
| TypeScript | 1.8.10 || | mocha | mocha | | node-runner | | TypeScript utilizes `require` instead of concatenating files |
116+
116117
## Setup
117118

118119
You should have [Docker](https://www.docker.com/) installed, if not do that first. Before you can run any of the code

frameworks/ruby/sql.rb

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ def select_cmd?(cmd)
1818
end
1919

2020
def run_cmd(cmd)
21-
select_cmd?(cmd) ? DB[cmd] : DB.run(cmd)
21+
try_connection do
22+
select_cmd?(cmd) ? DB[cmd] : DB.run(cmd)
23+
end
2224
end
2325

2426
def split_sql_commands(sql)
@@ -122,8 +124,26 @@ def pluck_unique(column_name, results = last_results)
122124
results.map {|r| r[column_name]}.uniq
123125
end
124126

127+
def try_connection
128+
begin
129+
yield
130+
rescue Sequel::DatabaseConnectionError => cex
131+
Display.status "Connection error: #{cex.message}, retrying in 1 second..."
132+
sleep 1
133+
retry
134+
rescue => ex
135+
if defined?(PG::ConnectionBad)
136+
if ex.is_a?(PG::ConnectionBad)
137+
sleep 1
138+
Display.status "Connection not ready, retrying in 1 second..."
139+
retry
140+
end
141+
end
142+
end
143+
end
144+
125145
# connect the database
126-
begin
146+
try_connection do
127147
Display.status "Connecting to database..."
128148
# Setup database connection
129149
DATABASE = ENV['DATABASE_NAME']
@@ -144,15 +164,4 @@ def expected
144164
end
145165
END
146166
end
147-
148-
rescue => ex
149-
if defined?(PG::ConnectionBad)
150-
if ex.is_a?(PG::ConnectionBad)
151-
sleep 1
152-
Display.status "Connection not ready, retrying in 1 second..."
153-
retry
154-
end
155-
end
156167
end
157-
158-

0 commit comments

Comments
 (0)