diff --git a/lib/coursemology/polyglot/language.rb b/lib/coursemology/polyglot/language.rb index 51a3aa9..8c1486b 100644 --- a/lib/coursemology/polyglot/language.rb +++ b/lib/coursemology/polyglot/language.rb @@ -30,6 +30,10 @@ class Coursemology::Polyglot::Language autoload :CPlusPlus autoload :Java autoload :R + autoload :CSharp + autoload :TypeScript + autoload :Go + autoload :Rust end # Marks the current class as a concrete language. diff --git a/lib/coursemology/polyglot/language/c_sharp.rb b/lib/coursemology/polyglot/language/c_sharp.rb new file mode 100644 index 0000000..ab81626 --- /dev/null +++ b/lib/coursemology/polyglot/language/c_sharp.rb @@ -0,0 +1,7 @@ +class Coursemology::Polyglot::Language::CSharp < Coursemology::Polyglot::Language + syntax_highlighter 'csharp', ace: 'csharp' + + class CSharp5Point0 < Coursemology::Polyglot::Language::CSharp + concrete_language 'C# 5.0', docker_image: nil + end +end diff --git a/lib/coursemology/polyglot/language/go.rb b/lib/coursemology/polyglot/language/go.rb new file mode 100644 index 0000000..504c99f --- /dev/null +++ b/lib/coursemology/polyglot/language/go.rb @@ -0,0 +1,7 @@ +class Coursemology::Polyglot::Language::Go < Coursemology::Polyglot::Language + syntax_highlighter 'golang', ace: 'golang' + + class Go1Point16 < Coursemology::Polyglot::Language::Go + concrete_language 'Go 1.16.2', docker_image: nil + end +end diff --git a/lib/coursemology/polyglot/language/java_script.rb b/lib/coursemology/polyglot/language/java_script.rb index ea6845b..fdcc3cc 100644 --- a/lib/coursemology/polyglot/language/java_script.rb +++ b/lib/coursemology/polyglot/language/java_script.rb @@ -1,4 +1,10 @@ class Coursemology::Polyglot::Language::JavaScript < Coursemology::Polyglot::Language - syntax_highlighter 'javascript' + # This is the old 'JavaScript' programming language before proper version specifiers were added. + # It should not be removed before all associated submissions are migrated to the versioned languages. + syntax_highlighter 'javascript', ace: 'javascript' concrete_language 'JavaScript', docker_image: 'javascript' + + class JavaScript22 < Coursemology::Polyglot::Language::JavaScript + concrete_language 'JavaScript 22.16.0', docker_image: nil + end end diff --git a/lib/coursemology/polyglot/language/rust.rb b/lib/coursemology/polyglot/language/rust.rb new file mode 100644 index 0000000..972e94c --- /dev/null +++ b/lib/coursemology/polyglot/language/rust.rb @@ -0,0 +1,7 @@ +class Coursemology::Polyglot::Language::Rust < Coursemology::Polyglot::Language + syntax_highlighter 'rust', ace: 'rust' + + class Rust1Point68 < Coursemology::Polyglot::Language::Rust + concrete_language 'Rust 1.68.2', docker_image: nil + end +end diff --git a/lib/coursemology/polyglot/language/type_script.rb b/lib/coursemology/polyglot/language/type_script.rb new file mode 100644 index 0000000..d384b91 --- /dev/null +++ b/lib/coursemology/polyglot/language/type_script.rb @@ -0,0 +1,7 @@ +class Coursemology::Polyglot::Language::TypeScript < Coursemology::Polyglot::Language + syntax_highlighter 'typescript', ace: 'typescript' + + class TypeScript5Point8 < Coursemology::Polyglot::Language::TypeScript + concrete_language 'TypeScript 5.8.3', docker_image: nil + end +end diff --git a/lib/coursemology/polyglot/version.rb b/lib/coursemology/polyglot/version.rb index ce59857..cd3050a 100644 --- a/lib/coursemology/polyglot/version.rb +++ b/lib/coursemology/polyglot/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Coursemology; end module Coursemology::Polyglot - VERSION = '0.4.1'.freeze + VERSION = '0.4.2'.freeze end diff --git a/spec/coursemology/polyglot/language/c_sharp_spec.rb b/spec/coursemology/polyglot/language/c_sharp_spec.rb new file mode 100644 index 0000000..cd1c912 --- /dev/null +++ b/spec/coursemology/polyglot/language/c_sharp_spec.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true +require 'spec_helper' + +RSpec.describe Coursemology::Polyglot::Language::CSharp do + describe Coursemology::Polyglot::Language::CSharp::CSharp5Point0 do + it 'returns the correct display name' do + expect(subject.class.display_name).to eq('C# 5.0') + end + + it 'returns a nil docker image' do + expect(subject.class.docker_image).to be_nil + end + end +end diff --git a/spec/coursemology/polyglot/language/go_spec.rb b/spec/coursemology/polyglot/language/go_spec.rb new file mode 100644 index 0000000..09419d7 --- /dev/null +++ b/spec/coursemology/polyglot/language/go_spec.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true +require 'spec_helper' + +RSpec.describe Coursemology::Polyglot::Language::Go do + describe Coursemology::Polyglot::Language::Go::Go1Point16 do + it 'returns the correct display name' do + expect(subject.class.display_name).to eq('Go 1.16.2') + end + + it 'returns a nil docker image' do + expect(subject.class.docker_image).to be_nil + end + end +end diff --git a/spec/coursemology/polyglot/language/java_script_spec.rb b/spec/coursemology/polyglot/language/java_script_spec.rb new file mode 100644 index 0000000..25ac72e --- /dev/null +++ b/spec/coursemology/polyglot/language/java_script_spec.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true +require 'spec_helper' + +RSpec.describe Coursemology::Polyglot::Language::JavaScript do + describe Coursemology::Polyglot::Language::JavaScript::JavaScript22 do + it 'returns the correct display name' do + expect(subject.class.display_name).to eq('JavaScript 22.16.0') + end + + it 'returns a nil docker image' do + expect(subject.class.docker_image).to be_nil + end + end +end diff --git a/spec/coursemology/polyglot/language/rust_spec.rb b/spec/coursemology/polyglot/language/rust_spec.rb new file mode 100644 index 0000000..d1805d8 --- /dev/null +++ b/spec/coursemology/polyglot/language/rust_spec.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true +require 'spec_helper' + +RSpec.describe Coursemology::Polyglot::Language::Rust do + describe Coursemology::Polyglot::Language::Rust::Rust1Point68 do + it 'returns the correct display name' do + expect(subject.class.display_name).to eq('Rust 1.68.2') + end + + it 'returns a nil docker image' do + expect(subject.class.docker_image).to be_nil + end + end +end diff --git a/spec/coursemology/polyglot/language/type_script_spec.rb b/spec/coursemology/polyglot/language/type_script_spec.rb new file mode 100644 index 0000000..6bc4c4e --- /dev/null +++ b/spec/coursemology/polyglot/language/type_script_spec.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true +require 'spec_helper' + +RSpec.describe Coursemology::Polyglot::Language::TypeScript do + describe Coursemology::Polyglot::Language::TypeScript::TypeScript5Point8 do + it 'returns the correct display name' do + expect(subject.class.display_name).to eq('TypeScript 5.8.3') + end + + it 'returns a nil docker image' do + expect(subject.class.docker_image).to be_nil + end + end +end