We're sorry but this page doesn't work properly without JavaScript enabled. Please enable it to continue.
Feedback

Power up Your Development with RubyMine

00:00

Formal Metadata

Title
Power up Your Development with RubyMine
Title of Series
Part Number
16
Number of Parts
89
Author
License
CC Attribution - ShareAlike 3.0 Unported:
You are free to use, adapt and copy, distribute and transmit the work or content in adapted or unchanged form for any legal and non-commercial purpose as long as the work is attributed to the author in the manner specified by the author or licensor and the work or content is shared also in adapted form only under the conditions of this
Identifiers
Publisher
Release Date
Language

Content Metadata

Subject Area
Genre
Abstract
There are many development tricks and habits that lie at the root of productive coding. IDEs, like RubyMine, are a big one. Adopting a new tool does require an initial investment of time though, as you customize your environment and learn the shortcuts.
81
AreaDifferent (Kate Ryan album)Integrated development environmentMultiplication signProduct (business)Goodness of fitData managementBitCoroutineMereologyGraph coloringView (database)Category of beingPoint (geometry)GenderLevel (video gaming)Numbering schemeComputer animationSource code
Default (computer science)Presentation of a groupBitMoment (mathematics)Projective planePoint (geometry)Electronic mailing listData structureComputer programmingView (database)WindowGame theoryNetwork topologyMetropolitan area networkComputer iconCodeMaxima and minimaInsertion lossText editorKey (cryptography)System callCuboidArmSource codeComputer configurationCASE <Informatik>CausalityIntegrated development environmentQuicksortField (computer science)Computer fileClosed setGreatest elementRemote procedure callAsynchronous Transfer ModeContent (media)Open setGraph coloringMereologyLevel (video gaming)NumberBlogRight angleInstallation artPlug-in (computing)1 (number)Software bugFerry CorstenShift operatorMappingKeyboard shortcutFreewareArtificial lifeMultiplication signGoodness of fitSource codeComputer animation
Electric generatorGame controllerMereologyMultiplication signView (database)RobotBitActive contour modelProjective planeComputer fileAdditionMathematicsData structureSocial classCorrespondence (mathematics)Point (geometry)Group actionSineAuthorizationMassLimit (category theory)Line (geometry)Term (mathematics)CASE <Informatik>Source codeEndliche ModelltheorieState of matterLibrary (computing)Logic gateArithmetic meanNichtlineares GleichungssystemPartition (number theory)CodeEscape characterShift operatorRight angleObject (grammar)Network topologySource codeComputer animation
CodeComplete metric spacePlug-in (computing)Data structureProjective planeMultiplication signGroup actionSelectivity (electronic)DampingCursor (computers)Computer fileShift operatorType theoryGame controllerSoftware bugMathematicsSource codeView (database)PlastikkarteBitLine (geometry)Point (geometry)Power (physics)EmulatorVariable (mathematics)Semantics (computer science)Template (C++)Revision controlIntegrated development environmentGoodness of fitPressureArithmetic meanEndliche ModelltheorieKeyboard shortcutVideo gameWebsiteSign (mathematics)Right angleCodierung <Programmierung>Cellular automatonCodeInformation securityCore dumpSystem callPRINCE2MultiplicationAreaSampling (statistics)Frame problemSoftware testingLaptopExtension (kinesiology)Source code
Error messageText editorCodeShift operatorComputer configurationConfiguration spaceProgrammierstilCode refactoringPoint (geometry)BitOpen sourceSet (mathematics)WritingGoodness of fitTemplate (C++)WindowCursor (computers)Multiplication signPower (physics)Computer fileAsynchronous Transfer ModeGroup actionComputer iconSound effectPolarization (waves)Variable (mathematics)LoginFerry CorstenOpen setQuicksortCASE <Informatik>Cartesian coordinate systemClient (computing)Arrow of timeFormal languageStaff (military)State of matterSource codeCodeInformation securityEndliche ModelltheorieInheritance (object-oriented programming)Right angleSystem callRootMedical imagingElement (mathematics)Mathematics1 (number)DataflowSocial classProjective planeSource codeComputer animation
Filter <Stochastik>Software testingRevision controlTerm (mathematics)Inheritance (object-oriented programming)CodeProjective planeElectronic mailing listVariable (mathematics)Computer fileClique problemMathematicsMultiplication signDatabaseControl flowComputer configurationEvent horizonComputer iconPoint (geometry)Flow separationLinear regressionSet (mathematics)Greatest elementCoefficient of determinationSource codeCASE <Informatik>Library (computing)Game controlleroutputSound effect1 (number)Default (computer science)Exception handlingAdditionNetwork topologyText editorService-oriented architectureView (database)Configuration spaceKeyboard shortcutHuman migrationVideo game consoleDifferenz <Mathematik>Right angleWindowQuery languageBitTable (information)Shift operatorMixed realitySoftware bugSource code
Computer animation
Transcript: English(auto-generated)
Yes, sure. Good morning, everyone. Are you awake? Okay, yeah. It is the first talk in
the morning. It is always a little bit sleepy. So, welcome to my talk. Thanks for coming. This talk is going to be about RubyMine, about RubyMine, different tips and tricks and some productivity hints and I hope we will learn something new today. But before we can start, I would ask you to do something for me, so please stand up. Okay, thank you.
So please raise both your hands if you use RubyMine. Okay. Please just stay. Please
raise both your hands if you don't use RubyMine. No, no, no, just stay with your hands, yeah? Okay. Let's raise your hand a bit. Okay, yeah, morning routine. Thanks a lot. So please sit down. I think that now we are ready to start. So my name is Tatiana. I'm a product marketing manager of RubyMine. I'm a part of RubyMine
team at JetBrains, but I'm not a developer. I used to be a developer 10 years ago. I used to be a Ruby Rails developer when Rails was really young, but now I'm not. So if something is not working today, don't blame me. Okay, I'm joking. I'm a part of RubyMine
team, so of course you can blame me, but I will blame the team, the developers. Okay, so let's start. When talking about IDE, the first thing you start with is actually making your environment looking good for you and making your environment comfortable
as possible to your eyes and fingers. So we'll start with some tips in making your IDE a little bit more suitable for your needs. And we'll start with the color scheme. Oh, sorry. It's my rescue time. So let's go here. I want to use this very quick
switcher and change the look and feel, for example, to dark one, or you can switch it back to default one, and just want to ask you which is better for you for
this presentation for today. Dark one? Okay. Okay. A little bit dark. So another thing that sometimes it's useful when you're working in a pair for something or making presentations, so it's a very quick way to switch the color. And the same way
you can switch the key map, I'm using this one, but of course you can use another one. We have some predefined ones like TextMate, Emacs, and some others. Again, for example,
if you're pair programming with someone who uses another key map, it is the best way to switch between them. You don't need to go to preferences to search for key maps there. You can just make it in one click. But still, if you want to go to preferences and, for example, adjust the key map for your needs, you can do it here. Go to key
map and preferences. You can see all the comments here. You can change the shortcuts, and you can even search by K stroke, and then change it. So you can adjust any predefined key map for your habits and for things that you are used to.
Okay. So let's go back. And of course you can also adjust all the colors. I mean that we can switch this predefined color schemes, but again, you can save all the colors for everything you need to. You can change it, adjust, just in case you need it.
And another thing I want to show you that from my point of view is quite useful. It is a list of plugins. You can see that we have a lot of them. Most of them are bundled with RubyMine, so they are pre-installed. But if you need something more from RubyMine,
you can always go to the list of plugins and install something new. For example, for this presentation, I am using this one, presentation assisted plugin. It shows all the shortcuts I use at the bottom. So here it is. And to install a new one, you just need to go to this install JetBrace plugins or
even to install, not like this from JetBrace, but from the community. Okay, so you can also adjust the look and feel of the window. You can see that I have
it in my view, I have a project tree at the left, so usually I have an editor at the right. You can also switch all the toolbar, switch on, navigation bar, status bar, and here is the small icon that helps you to navigate among all the tool windows.
You can have these tool window icons here, but you can hide them as well. And another interesting tip here is that you can see the numbers in the name and the title of every tool window, and that number means that you can choose command this number to open this tool window, like command one to open project view and to hide it.
Or for example, command four to open a run window and to hide it. And if you're open too many, for example, tool windows, a lot of them, and you're a little bit lost and you want to go back to your code, the best way to do is to
use shift command F12. This will hide all the tool windows and just go back to editor for you. So it's a good way to stay focused on your code without having all these tool window icons actually open. So I hide them, I don't need them. I navigate with a keyboard
and I don't need to see all of them all the time. If you want something even more, to be even more focused on your code, you can go to this view mode and enter destruction free mode, and it looks like that. Nothing, just
code. Or you can exit this destruction view mode, and for example enter presentation mode, and it will look like that. Sometimes I use it when I'm coding a lot, when I have
live coding during the presentation, but today I won't use it because I want to show you all the windows and all the ID. Actually we won't code, so I will exit it. Okay, so something that was about setting up your environments, and now let's talk
a little bit more about navigation through your code. Maybe the most common way to navigate the most simple one is to see this project tree, project structure, and nothing special
here, just I hope you know that you can search here. Just start typing and you will search for all these tree, but the things that I want to show you is this small icon in the things, and these two options. It is auto scroll to source, and auto scroll from
source. By the way, who uses that? Whoa, one person, okay. So if you switch out a scroll to source, it means that when just going through your tree, you will also open
all the files in the editor, but frankly speaking, I don't like it. I don't think it's very useful. What I do like is another one. It is auto scroll from source, and this one means that when switching through your tabs, through your code, you will still be aware where you are in your project when the project structure is opened. Sometimes
it's good. For example, when you are debugging and digging in your code, sometimes you really need to know where you are when you are a little bit lost. From my point of view, it is a good option. Okay, so it's about project view. Another
thing is that if you are doing Rails, and I think that most of you are doing Rails because we are at RailsConf, you can also switch this project view. Okay, don't blame me. Please blame developers. Just a moment. Let's try to fix it on the
fly, but I will definitely add a bug report. Sorry for that. Okay, so you can use this object. You will see the structure of your code, not at the folders and files structure,
but by means of models, views, and controllers. What you can see here is all the controllers in one place, and for example, under each controller, you can see all directions, and under each, actually, you will see all the corresponding views, so kind of Rails
view, and of course, you can navigate from here as well. Let's switch to views and et cetera, but if you still need, for example, I prefer Rails view, but sometimes I still need to get back to project structure view, to folders and files structure. The
best way to do this is not to switch this project view, actually, but to use navigation bar, so you can see that here on the top, I have navigation bar, and I can really easy, very, very easy navigate through all the folders, and I can, again, just start typing
here, and it understands snake case and, of course, camel case, so it's a good way to navigate through your files and folders if you still need them without opening project tree view at the left, or staying on your Rails view there. Okay, but I have a question,
one question. Do you feel comfortable with this view, or something is a little bit weird, a little bit strange, something you don't like? Come on. Any ideas? Tabs, yeah, hooray.
I think that, yes, I think that tabs are really awkward here. They take so many place of your code editor. Why do you need them? I don't think that we actually do need them. I don't. I hope that you don't as well, so the best way to deal with them is just
to switch them at all, switch them off, and we can, of course, do it with the preferences, go to preferences, find the right line here, and switch it back, but I have a smarter way. It is a way by using find action feature. Do you use it? Do you know that you can,
with this shortcut, you can find every action in the ID by the name, like start searching like copy or something like that, and it is also a good way, if you forgot some shortcuts, to remember it, but it is also a good way to change preferences. For example, if
I start typing, not tab, but tab placement, here you can see that all the preferences are listed here as well, so just start searching, and you can just manage them from
there. There's no need to go to preferences. There's no need to search through all the preferences lists, so please use it, but you may now ask me if I don't have tabs, how I'm going to navigate through my recently edited files and so on, and the best way
to do it for me is to use command E to see all the recent files or to shift command E, and you will see all the recently edited files, and frankly speaking, you will see all the files and tool windows, and from my point of view, it is much better than
tabs. Of course, you can just start typing here to filter if you have the huge list, if you have edited a lot. Another thing that I'm sorry, just want to click escape
if you still want to go to, let's go back to controller, and sometimes if I'm in view, I can do with a simple icon. If I want to navigate not only through my files, but
also to navigate, let's do here for example, to navigate through all the methods for example, in my class, in my file. The best way for me to do it is to use command F12. It shows structure pop up, and it shows all the methods, and the interesting
thing here is that if you will click it once more time, you will see all the inherited methods as well, so sometimes quite useful. Another thing, a little bit more smarter
navigation is actually to use go to definition, because I believe that a lot of times what you really need is not to navigate to any file or class, but to navigate to declaration, to definition of any variable or method you are looking at. The best way to do is to use command B, and you will navigate to definition, to declaration, and you can
use it again and again to dig your code, and you will navigate to libraries, to gems as well, not only through your source, through your project, but through your gems as well.
And you can also use this one is command Y. If you don't want to switch to that file where the definition is, you can use this quick definition pop up to see the method definition in the pop up, not going to the file.
Okay, so now I have a question for you. Please raise your hands if you already used something new from the last slides. Okay, great. Now you can leave. No, I'm joking. I'm hoping that you will leave something more new as well.
Okay, let's talk a little bit more about coding now. So, yeah, starting with creating new file, I think that it is very basic action. I hope that you know it, but an interesting thing here hopefully noted that you can use Rails generators from here as well to
use your scaffolding controls and whatever. And one more thing here is that when creating for example a new file, simple file, you can also use like directors here and everything
will be created for you. No, I don't want to edit. And with this auto scroll from source action, you can see that you will be navigated through a project, in your project structure very fast as well. So here I am. No, don't really need it. So I'm going
to delete. Yeah. But sometimes, for example, myself, sometimes I want to create these temp files, temporary files, temporary directors with these four Rb files just to experiment, to play with some piece of code. And for making that,
I don't want these files to be stored in my project structure. I don't actually want them to be stored in my version control system or I just want to play with them. And the best way to do that, not to create these temporary folders and these four Rb files,
but to create scratch files. And you can do that with shift command N, create for example some Ruby file, and it is like file, but it is not physical file in your project structure. It will be stored inside Ruby, my inside IDE. But still you can start coding here and everything will be available, like code completion. And good thing is that
you can also use shift control R, yeah, and you can run it from here as well. So for Ruby code, it's pretty useful from my point of view.
Okay. And if you want to go, for example, to see where these files actually are, you can go here, go to scratch files, again the same box, sorry for that, but I won't do this now. And you can see there that, for example, I have free scratches, so they
are stored for you. You can then back to them again and do something. Okay. Let's change behavior a little. Okay, it's just my thoughts about this bug. Let's go back to some controller. For example, yeah, this one, this one. Of course, when
coding, you manipulate code a lot, and you use a lot of copy and select code actions and so on and so forth. And in Ruby mind, they're pretty, pretty, the basic ones, but
still I don't know if you use it. You can use this extend selection. It is quite useful. It will select the chunks of code semantically. And you can then, like, for example, here, yeah. And you can then, for example, move them. Please don't do copy
and paste. Just move them if you need moving. And you can also copy some lines, and you don't need to select the whole line. You just need to put a cursor on it. And you can duplicate them, delete them. Again, you don't need to select the whole line.
Just put the cursor. And when copying a lot of them, and if you need to paste, you can use it with shift, and you will see the history of your clipboard. So sometimes it is useful as well. And we also do have some multiple selections. You can set multiple
cursors by finding next occurrence, for example. And you can just start typing, and you will see that code completion is working here as well. You can use it for all the places.
And so on and so forth. Really speaking, if you want all the power of, for example, WIM editing, and I have, by the way, who is using WIM? Okay. So, for example, if you want the whole power of WIM
editing, code editing in RubyMine, so if you want to have the balls from balls balls, the best way to do it is to install a special plug-in. You need to go to plug-ins, find idea, WIM plug-in. You need to install it. It is not bundled from this generation
of plug-ins. And once it is installed, you can go here to tools, WIM emulator, and just enable the emulation. I won't do that, but if you want to try, you are more than welcome to go to, after my talk, or to go to our booth, JetBrains booth, we have it, and
to try on my laptop, for example, with this plug-in, just to try all the actions. Because I'm not a WIM user, so I'm just not, even not pretending to try all the smart things from WIM, but you still can take a look how it works in RubyMine. Okay, so, one more thing
about editing, I want to talk a little bit more about code snippets. So, do you use code snippets? Okay, so, yeah, okay. So, in RubyMine, we have a lot of predefined code snippets, a huge list, but you can also create your own ones. And sometimes,
it's a great way, when you have a kind of, where you're looking similar code, that you don't want to type a lot of times. And I'm not thinking about refactoring here, I'm just, it's another topic, okay. So, you can just select this code fragment, and
go here, like, save as live template. Here it is. And you will need to add a title for it, and you can go there, and add some variables here. I also want to add, and variable,
it means that I want to put a cursor, another line, after ending with this code snippet. Okay, let's now try. So, if I go there, and now, command G, and now,
TCC, you remember, is our new here, you can see that cursor was placed on the right place, it is the first variable place, and now you can start just typing, and complete,
and it will be completed, according to our code snippet template. And then, I just click tab, and go to the end of line, it is the end of my code snippet. Okay, so, let's go back to them, to the list, just to show you that, of course, you can also
use a lot of predefined ones, or you can change them slightly if you want, or you can set up your own ones. And we have a lot of them, not only for Ruby, but for JavaScript, and Rails, and SQL, and everything. Okay, I'm just going to delete this one.
Another really quick way to code, when now talking about HTML, it is Emmet. So, anyone using Emmet here? Okay. I really do like Emmet, I'm not really experienced in it,
but still. So, you can use it in RubyMine as well, just start typing, and then, with the tab, it will make you HTML from your Emmet, and another thing that you can
now select this code, and use shift command G, no, alt command G, sorry, yeah, and surround it with Emmet. So, like here, yes, here it is. And, you can also, if
you're not really sure about your Emmet, I use it a lot, you can also choose Emmet preview. Oh, where's my link? Okay, oh, I see, yes, it depends on the place where the
cursor stays. So, you can preview before adding to your code. Okay, and now, from example, if I change something, sometimes I want to look a little bit nicer, and I mean
that sometimes I want to, after that, to reformat it, to make code style looks good. So, talking about code styles, there are several ways to work with the code styles in RubyMine, and first of all, we have a lot of code style preferences in our preferences,
you can change them if you want to, they're based on some community styles, and you can use this alt command L with shift to define a scope for the code fragment that
you want to reformat, according to these code style settings. But, actually, you can also use editor config. Anyone using editor config? Yeah, oh, you're not doing a lot of open source or something like that, because they are due to have editor config files
with the code style settings, just to have the same code style for all the developers among the project. Okay, so, by the way, if you have editor config, you can just put this file, editor config file, at the root, and all the code style settings will be
got from here, sorry, sorry for my English. And if you're writing JavaScript and using ESLint, you can set up RubyMine to use this one as well. It's about code style. Okay, we have not a lot of time here. So now I want to talk a little bit more about
not only writing your code, but about cleaning it up. So about some inspections and refactorings. Hope you know about our, I need some broken code, at least. Okay, yeah, here it is.
Hopefully you know that RubyMine highlights all the errors, according to a lot of inspections that we have, and it provides a quick fix option. So with alt-enter, you can see
that it was unless used with else, and you can just click enter to fix it, to change the code. And sometimes it is a good way just maybe to provide, for example, new methods so not only to clean your code, but to write it as well. Like you're just putting a method
without declarating it, and then you're just going to intention action and create it with one click. And one thing that maybe you don't know that you also have this small icon where you can manage your highlighting level and switch the power safe
mode if you need to. So if you don't want to have all these highlighters, no problem. Just don't be panicked, just switch it off. It's okay. But be responsible for your code
in this point. And we have, you can also run a code inspector through all the whole projects, for example, to see all the errors that RubyMine can find. And I want to show you one of the examples. It is not only expecting, but it is also about locating duplicates. Here it is. RubyMine finds all the duplications
in your code. You can see the details here, like here. It is almost identical, you can see. Or like here, it is just identical. And it means that if you have
a lot of duplications in your code, it means that you want to do something with this code. It is definitely not dry. And you can just go from this window to your editor. You can see that we have navigated to an editor, and we have RubyMine highlights
this code fragment. And now I can, for example, just select it and use my refactor, this option, and for example, extract method from this code. Some new method. Okay. And this dialogue is very interesting, because you remember
that we had two places with the same code. So RubyMine warns you that if you're extracting a method from a code fragment, if you do have the same code fragment, so you probably want to change, to invoke this method there as well. So do we want to replace it? Yes.
Do we want to replace it? Yes. Okay. So it's just a way to inspect and refactor, like your code. Okay. Now let's talk a little bit more about
testing and debugging stuff. All my tests with Rake. Yeah. And while running, maybe if you use test runner, maybe you know that by default it is on the bottom, but
you can always move this tool window with this option. You can move it top, bottom, left or right. No matter. I like to place it on the left, but maybe prefer some other options. The interesting things here I want to show you is this small icon.
It filters all the tests. So you can see all the list of all tests, or you can just click and see all the failed ones. So I think that you might want to stay focused on the failed ones, not on the green ones. And you can see what was wrong by switching,
and you can see here what was going on, and you can just navigate by clicking from here to the test code. So it's quite useful. And again, if you have some failed tests and you want to find out what was wrong, you can navigate to test, and a good way
is just to debug this test. It is like a quite natural next step, I guess. So you can just put a breakpoint here, and you can debug control shift D. I just forgot.
Okay, so you can see that now our test is running on a debug mode, and we stop at a breakpoint. You can see that. And we can see the list of variables here. Yeah, and we can go step by step. Oh, okay. I said equal, maybe. Just one more time to show
you without step over, but with step inter. So here it is. You can step over, you can step inter. You can go through your code, look for some more details. And by the
way, you can also manage breakpoints. You can go to these more breakpoints and see all the breakpoints for your code. You can enable or disable them. So if you have a lot of them, sometimes it is also useful. And you can also add some
exception, additional breakpoints, and et cetera. And one new, quite a new feature that I want to tell about debugging, it is this small preference.
So we can go there, and you can see that we have this small setting in debugging
and it actually means that you can decide whether you want to step into your libraries, into your gems, or you want to stay inside your project. So if you don't want to go to dig into all the libraries, just put this setting and you will debug by stepping over all in your code. Even if you have
breakpoints there in your gems, you will go only through your code and step over all breakpoints in your own code. Okay, so the main tips and tricks, and just one more question. If you use version control system
with RubyMine, if you use RubyMine, okay. We have not a lot of time, and maybe if you don't mind, I will ask for all the questions afterwards or at the booth, because I want to show you one more tricks if you don't mind. Okay, so about version control systems.
Quite a useful thing. Let's go to version control. Okay, you can see all the history here for all the project, for all the repository, and you can see your local changes. But the useful thing, the small
trick I want to show is that, for example, if you are going to commit your changes, not push, okay, command K. That was the wrong shortcut. Yeah. You can see that we have this commit dialogue
with the diff view as well, and now you can actually edit your code just in your commit dialogue. If you need to fix something small, and you mention it, you don't need to go back to editor. You just need to check this icon, and now you can just change
whatever you need. For example, just get the version from the left or just start typing here, something. So whatever you want. So it's a small trick that, from my point of view, is quite useful
if you are using version control systems. Okay, and one more question about databases. Do you use databases in RubyMine? DatabaseU? Okay. So you know about them quite a lot. But if you don't use, just want to let you know that we have
this database where you can see all the data you have, and you can just open your tables. You can see all the data. Of course, you can even change the database from here, but I think it's better to do with migration files, you know. But when you want to look
for your data and to have some queries like we do, it's sometimes good to go, for example, to where is it? Yeah, here it is. Like, open some console and just start typing,
and it will highlight, or not highlight, but complete everything you need. So you can run them and what else. So you can play with the database. And you don't need to set up everything, because as far as Rails project do have database configurations
files, actually everything you need when you set up your database the first time, you need to go to this database, click here, and import from sources. So everything will be suggested to you, just according to your database configuration files. So it's quite useful from my point of
view. Okay, so that's it. Only one minute left. Thank you for your attention. If you have some short questions, I will be glad to answer, or we can just have a chat after the talk or at the booth. We have a booth at the exhibition called JetBrains, like JetBrains. So if you want to have more demos, if you have any questions, we will be
glad to help. And there, one guy, he's a developer, to remind you, so if you want to blame something, to have some bugs to talk about, come on, you're very welcome. Okay, so thanks, thank you.