Chapter 1: Installing NetBeans IDE with Ruby Support 1 Downloading the IDE .1 Installing the Java Software Development Kit 2 Installing the IDE .3 Adding Ruby to an Existing NetBeans Installation 4 Summary 6 Chapter 2: Trying Out the IDE .7 Creating a Ruby Project 7 Creating a Rails Project 11 Summary 16 Chapter 3: Configuring Your Environment .17 Registering Ruby Installations .17 Managing Gems 20 Using the Ruby Gems Manager 21 Gems Repository Permissions . 22 Using the Gem Tool from the Command Line . 23 Installing Gems That Have Native Extensions . 25 Adding Servers 26 Accessing Databases from the IDE 27 Creating Databases from the IDE 27 Registering Existing Databases with the IDE . 28 ii NetBeans™ Ruby and Rails IDE with JRuby Working with Databases from the IDE . 30 Summary 32 Chapter 4: Working with Ruby Projects .33 Setting Up Ruby Projects 33 Using the Project and Files Windows 36 Adding Files 38 Running Ruby Applications 40 Running Rake Tasks .43 Using Interactive Ruby (IRB) .44 Summary 46 Chapter 5: Working with Rails Projects .47 Setting Up Rails Projects 47 Working with Databases .51 Setting Database Configurations . 51 Using Databases with JRuby . 55 Creating Databases 57 Creating and Changing Tables 58 Working with Generators 60 Adding Files 62 Running Rake Tasks .62 Adding Plugins 63 Running Applications .64 Using the Rails Console 67 Summary 68 NetBeans™ Ruby and Rails IDE with JRuby iii Chapter 6: Editing Files .69 Live Code Assistance .69 About Semantic Coloring 72 Using Code Completion 74 Using Live Code Templates 77 About Hints and Quick Fixes .79 Refactoring Code .81 Navigating Code 86 Navigating Within a File . 86 Navigating to Members . 88 Navigating to Files 89 Viewing RDoc 96 Working with Task Lists .98 Viewing Recent Changes 99 Keyboard Shortcuts .100 Summary 102 Chapter 7: Testing and Debugging Projects 105 Creating Tests 105 Creating Unit Tests 106 Adding Fixtures . 109 Creating RSpec Tests 109 Running Tests and Specs 112 Using Autotest .115 Debugging Applications 116 Running the Debugger . 117 iv NetBeans™ Ruby and Rails IDE with JRuby Working with Breakpoints 119 Using the Debugger Window 122 Using the Local History Feature 123 Viewing Log Files .124 Summary 125 Chapter 8: Working with JRuby 127 Creating JRuby Projects .127 Adding Java Libraries to JRuby Projects 129 Using Java Classes and Methods in JRuby Projects .130 Setting JRuby Runtime Properties .132 Using JRuby in Java Projects .134 Summary 137 Chapter 9: Deploying Rails Applications 139 Creating WAR Files with the Warbler Plugin .139 Installing the Warbler Plugin 139 Configuring Warbler . 142 Creating the WAR File 143 Deploying to Application Servers .143 Deploying to the GlassFish Application Server 143 Deploying to Tomcat . 145 Summary 145 Chapter 10: Customizing the IDE . 146 Working with Editor Options 146 Tuning the Code Completion Pop-Up . 146 Setting Formatting Options . 148 NetBeans™ Ruby and Rails IDE with JRuby v Customizing Live Code Templates .150 Adjusting Hints 152 Creating Code Shortcuts 153 Changing Fonts and Colors .155 Modifying Keyboard Shortcuts .158 Modifying File Templates .160 Editing a Template 161 Using Template Properties 162 Adding Licenses to a Template . 164 Setting Task List Patterns .165 Working with Nodes, Files, and Folders 166 Displaying the Physical File Structure in the Projects Window . 167 Adding Ruby Script File Extensions . 168 Changing the Location of the Ruby Source Files Folder 168 Editing Hidden Files in the IDE 169 Tweaking Under the Hood 169 IDE Options . 170 Editor Options . 172 Troubleshooting the IDE 173 Summary 174