4. Install and Run $ sudo gem install rush $ rush rush> home=> localhost:/Users/schlueter/
5. No Working Directory $ home => localhost:/Users/schlueter $ root=> localhost://// $ rushmate = home[ "mydev/github/rushmate/" ] => localhost:/Users/schlueter/mydev/github/rushmate/
6. But ls Still Works $ home[ "mydev/github/rushmate/" ].ls /Users/schlueter/mydev/github/rushmate/ coverage/ lib/ test/ History.txt MIT-LICENSE Manifest.txt
7. Make a Variable $ rushmate = home[ "mydev/github/rushmate/" ]
27. Regex is your friend $ project_files.replace_contents! ( /User.authenticate *(.*), *(.*) / , 'User.authenticate( 2, 1)' ) User .authenticate(user, password) User .authenticate(password, user)
28.
29. Real World Rush :: EmbeddableShell . new .execute_in_shell do end ff_processes = processes. filter ( :cmdline => /firefox/ ) if ff = ff_processes.select{| p | p.mem > 400000 }.first ff_cmdline = ff.cmdline ff.kill home.bash ff_cmdline, :background => true end
34. Starts a Mongrel on Remote Server Use in production with caution
35. Customize # setup variables to common directories rushmate = home[ "mydev/github/rushmate/" ] # setup variables to common servers qa = Rush :: Box . new ( 'user@qa.local' ) ~/.rush/evn.rb
36. Cheap Backup def cheap_backup (directory) unless directory.dir? puts "cheap backup only works on dirs" return end backup_path = directory.path + "/" + directory.name + ".bak" if self [backup_path].exists? puts "backup already exists" else directory.duplicate(directory.name + ".bak" ) end end
37. Extend # allows you to run # directory.coverage def coverage self .rake( "coverage" ) end ~/.rush/commands.rb
38. Another Command def ruby_files self [ "**/*.rb" ] end $ rushmate.ruby_files .../mydev/github/rushmate/lib/rushmate.rb.../mydev/github/rushmate/lib/rushmate/command.rb.../mydev/github/rushmate/lib/rushmate/exit.rb ... => 9 x Rush::File
39.
40. TextMate Rushmate :: Command . new { # find ruby files with the current word in textmate found_files = project_directory[ "**/#{current_word.downcase}.rb" ] if found_files.size == 1 found_files.mate else menu_files = found_files.collect { | f | f.full_path.gsub(project_directory.full_path, "" ) } project_directory[user_input.quick_menu_from_array(menu_files)].mate end }