Browse Source

detect rust & cargo.

Lucas Stadler 11 years ago
parent
commit
240e24d1d1
2 changed files with 13 additions and 0 deletions
  1. 10 0
      go/detect/detect.go
  2. 3 0
      go/examples/hello.rs

+ 10 - 0
go/detect/detect.go

@ -42,6 +42,8 @@ var ProjectTypes = []*Project{
42 42
		"test": "bundle exec rake test"}, rubyRails},
43 43
	&Project{"ruby/rake", Commands{"run": "rake", "test": "rake test"}, rubyRake},
44 44
	&Project{"ruby/default", Commands{"run": "ruby {file}"}, rubyDefault},
45
	&Project{"rust/cargo", Commands{"build": "cargo build", "run": "cargo run", "test": "cargo test"}, rustCargo},
46
	&Project{"rust/default", Commands{"run": "rustc {file} && ./$(basename {file} .rs)"}, rustDefault},
45 47
	&Project{"make", Commands{"run": "make", "test": "make test"}, makeDefault},
46 48
	&Project{"procfile", Commands{}, procfileDefault},
47 49
}
@ -172,3 +174,11 @@ func rubyRake(file string) bool {
172 174
func rubyDefault(file string) bool {
173 175
	return matchingFileOrDir(file, "*.rb")
174 176
}
177
178
func rustCargo(file string) bool {
179
	return hasFile(file, "Cargo.toml")
180
}
181
182
func rustDefault(file string) bool {
183
	return matchingFileOrDir(file, "*.rs")
184
}

+ 3 - 0
go/examples/hello.rs

@ -0,0 +1,3 @@
1
fn main() {
2
	println!("Hello, World!")
3
}