做bundle -path使用错误的Ruby版本

时间:2015-11-02 20:36:09

标签: ruby bundler

我使用的是Ruby 2.2.2。当我class MainServer { private: SOCKET soo; bool init; public: MainServer() : soo(INVALID_SOCKET), init(false) { WSADATA wsa; printf("\nInitialising Winsock..."); int err = WSAStartup(MAKEWORD(2, 2), &wsa); if (err != 0) { printf("Failed. Error Code : %d\n", err); MessageBox(NULL, L"WSAStartup Failed", L"Failed", NULL); } else { init = true; printf("Initialized.\n"); //MessageBox(NULL, L"Initialized", L"Simple Message", NULL); } } ~MainServer() { close_server_socket(); if (init) WSACleanup(); } SOCKET socket_control_mob() { struct sockaddr_in server = {0}; close_server_socket(); //Create a socket soo = socket(AF_INET, SOCK_STREAM, 0); if (soo == INVALID_SOCKET) { printf("Could not create socket. Error Code : %d\n", WSAGetLastError()); MessageBox(NULL, L"Socket Not Created", L"socket Failed", NULL); return INVALID_SOCKET; } printf("Socket created.\n"); //Prepare the sockaddr_in structure server.sin_family = AF_INET; server.sin_addr.s_addr = INADDR_ANY; server.sin_port = htons(8890); //Bind if (bind(soo, (struct sockaddr *)&server, sizeof(server)) == SOCKET_ERROR) { printf("Bind failed. Error Code : %d", WSAGetLastError()); MessageBox(NULL, L"Binding Error", L"bind Failed", NULL); close_server_socket(); return INVALID_SOCKET; } printf("Bind done.\n"); //MessageBox(NULL, L"Bind Done", L"Simple Message", NULL); return soo; } void server_close_socket() { if (soo != INVALID_SOCKET) { closesocket(soo); soo = INVALID_SOCKET; } } }; 时,我得到了一个名为bundle --path vendor/bundle的文件夹。

My Gemfile指定Ruby 2.2.2。我的vendor/bundle/ruby/2.2.0指定2.2.2。

当我.ruby-version时,我得到rvm list。当我=> ruby-2.2.2 [ x86_64 ]时,我得到ruby -v。我甚至卸载了Ruby 2.2.0,当我ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-darwin14]时,我仍然得到2.2.0文件夹。

为什么使用Ruby 2.2.0,如何才能使用2.2.2?

1 个答案:

答案 0 :(得分:3)

我之前也见过这个,我想这可能是你问题的答案:

vendor/bundle and ruby version

您可以在rails控制台中快速验证:

> Loading development environment (Rails 4.2.4)
> 2.1.2 :001 > RbConfig::CONFIG['ruby_version']  => "2.1.0"