📜 ⬆️ ⬇️

Installing Ruby on Rails on Windows

I was interested in Rails. I bought a couple of books, read ... enough so that my hands were combed and it was time to put the subject. And start ... at least to experiment.

Task: put Rails under Windows 7 (do not ask me why) and start the server.

It turned out - this is a quest. A couple of mouse clicks are not enough. Of course, if you do not use Railsinstaller , what I was correctly hinted at in the comments (thanks, dreamfall).
')
A few hours of my searches, which ended in a complete and unconditional installation, under the cut.


1. We put Ruby . Strictly from here rubyinstaller.org/downloads . For here it is built under gcc MinGW 32, which will be used to build ruby ​​modules
1.1 We need version 187 . Version 192 requires more powerful shamanism, for which I did not have enough mana.
1.2 Install the Development Kit (we need it to build Rails), unpacking directly on top of the Ruby directory (if set by default, this is C: \ Ruby187, later we will call it $ Ruby )
1.3 You can also download the Ruby documentation

2. We need SQLite www.sqlite.org . Archive c dll-Coy and def file unpack directly into the $ Ruby \ bin directory . By the way, this was the first surprise (before, the RDBMS “default” was mySQL)

3. Launch Comand Prompt wiht Ruby (you will find it in the windows start-menu)

4. In the comand prompt put the modules:
4.1. gem install sqlite3-ruby - SQLite
4.2. gem install rails - the actual "rails". It is possible that the installation will fail with an error, in this case we repeat the command
4.3. Even if the error did not happen, you still need shamanism. For our every sneeze, such indecency will come out:
Invalid gemspec in [C: /Ruby187/lib/ruby/gems/1.8/specifications/json-1.6.1.gemspec]: invalid date format specification: "2011-09-18 00: 00: 00.000000000Z" .
This is an error associated with the date format. It is treated simply. Go to the $ Ruby \ lib \ ruby ​​\ gems \ 1.8 \ specifications directory and change the line “in error” files
s.date = %q{2011-09-18 00:00:00.000000000Z}
on
s.date = %q{2011-09-18}
4.4. To pacify the conscience gem update rails - include-dependencies

5. Create a test application. Also in the command prompt
5.1 Go to the "for games" directory, for example, cd \ test (or mkdir \ test; cd \ test - if there is no such directory)
5.2 Create an application rails new hello . The second surprise - in the books nothing was said about “new”.
5.3 We start our application. cd hello; rails server . And the last surprise - in the same books a link to a nonexistent script rails server /
5.4 at localhost : 3000 we suddenly discover our long-awaited application.

Voila!

Continuation will follow, if as recess more reefs are found.

Source: https://habr.com/ru/post/130689/


All Articles