diff --git a/src/project.hpp b/src/project.hpp index 7f76d26..178bbb8 100644 --- a/src/project.hpp +++ b/src/project.hpp @@ -104,11 +104,6 @@ namespace Project { #endif }; - class LanguageProtocol : public virtual Base { - public: - virtual std::string get_language_id() = 0; - }; - class Clang : public LLDB { public: Clang(std::unique_ptr &&build) : Base(std::move(build)) {} @@ -126,22 +121,18 @@ namespace Project { void compile_and_run(const boost::filesystem::path &file_path = {}) override; }; - class Python : public LanguageProtocol { + class Python : public Base { public: Python(std::unique_ptr &&build) : Base(std::move(build)) {} void compile_and_run(const boost::filesystem::path &file_path = {}) override; - - std::string get_language_id() override { return "python"; } }; - class JavaScript : public LanguageProtocol { + class JavaScript : public Base { public: JavaScript(std::unique_ptr &&build) : Base(std::move(build)) {} void compile_and_run(const boost::filesystem::path &file_path = {}) override; - - std::string get_language_id() override { return "javascript"; } }; class HTML : public Base { @@ -151,33 +142,27 @@ namespace Project { void compile_and_run(const boost::filesystem::path &file_path = {}) override; }; - class Rust : public LLDB, public LanguageProtocol { + class Rust : public LLDB { public: Rust(std::unique_ptr &&build) : Base(std::move(build)) {} std::pair get_run_arguments() override; void compile() override; void compile_and_run(const boost::filesystem::path &file_path = {}) override; - - std::string get_language_id() override { return "rust"; } }; - class Go : public LanguageProtocol { + class Go : public Base { public: Go(std::unique_ptr &&build) : Base(std::move(build)) {} void compile_and_run(const boost::filesystem::path &file_path = {}) override; - - std::string get_language_id() override { return "go"; } }; - class Julia : public LanguageProtocol { + class Julia : public Base { public: Julia(std::unique_ptr &&build) : Base(std::move(build)) {} void compile_and_run(const boost::filesystem::path &file_path = {}) override; - - std::string get_language_id() override { return "julia"; } }; std::shared_ptr create(const boost::filesystem::path &file_path = {}); diff --git a/src/project_build.cpp b/src/project_build.cpp index ce412c2..58271b2 100644 --- a/src/project_build.cpp +++ b/src/project_build.cpp @@ -63,6 +63,12 @@ std::unique_ptr Project::Build::create(const boost::filesystem:: return build; } + if(boost::filesystem::exists(search_path / ".git", ec)) { + std::unique_ptr build(new GitBuild()); + build->project_path = search_path; + return build; + } + if(search_path == search_path.root_directory()) break; search_path = search_path.parent_path(); diff --git a/src/project_build.hpp b/src/project_build.hpp index a962bf3..e644708 100644 --- a/src/project_build.hpp +++ b/src/project_build.hpp @@ -85,4 +85,7 @@ namespace Project { class GoBuild : public Build { }; + + class GitBuild : public Build { + }; } // namespace Project