Przeglądaj źródła

detect rust & cargo.

Lucas Stadler 11 lat temu
rodzic
commit
240e24d1d1
2 zmienionych plików z 13 dodań i 0 usunięć
  1. 10 0
      go/detect/detect.go
  2. 3 0
      go/examples/hello.rs

+ 10 - 0
go/detect/detect.go

42
		"test": "bundle exec rake test"}, rubyRails},
42
		"test": "bundle exec rake test"}, rubyRails},
43
	&Project{"ruby/rake", Commands{"run": "rake", "test": "rake test"}, rubyRake},
43
	&Project{"ruby/rake", Commands{"run": "rake", "test": "rake test"}, rubyRake},
44
	&Project{"ruby/default", Commands{"run": "ruby {file}"}, rubyDefault},
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
	&Project{"make", Commands{"run": "make", "test": "make test"}, makeDefault},
47
	&Project{"make", Commands{"run": "make", "test": "make test"}, makeDefault},
46
	&Project{"procfile", Commands{}, procfileDefault},
48
	&Project{"procfile", Commands{}, procfileDefault},
47
}
49
}
172
func rubyDefault(file string) bool {
174
func rubyDefault(file string) bool {
173
	return matchingFileOrDir(file, "*.rb")
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

1
fn main() {
2
	println!("Hello, World!")
3
}