Russ•Works

The Offical Weblog of Russell Jennings

Simpler Rails With Sublime Projects

Hide the files you don’t normally work on with the Sublime Text 2 Project feature. Includes example for Ruby on Rails.

Background

I work on Ruby on Rails sites in ST2 in my day to day work. For bigger projects, its easy to get lost in the files and folders. There are generally 3 levels of view that we want to achieve:

  1. files you work on often
  2. files you work on rarely
  3. files that you never touch

So with Projects in ST2, we can change what level of view we have, by selectively filtering out files and folders. Most of the time, you’ll want to be at #1, sometimes you’ll need to drop down to #2, and once in a blue moon drop down to #3.

Business

The below file is an example of #1 for a Ruby on Rails project. I’ll leave #2 up to you to sort out, use this as a template. #3 for me would be the default project view, such as opening the directory directly; but you may want to craft something for that perspective as well.

Of note: this moves the ‘migrate’ folder out of ‘db’ and makes it a top level item, outside of the project folder. I feel it makes it easier to work on that way, but that’s purely my preference.

Put this file in the root of your project with a name like “simple.sublime-project” then open it from the ‘Project’ menu.

Simpler Rails View Github Gist
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
{
    "folders":
    [

    {
        "path": "/",
            "folder_exclude_patterns": [
                "app/mailers",
                "app/helpers",
                "app/assets/images",
                "coverage",
                "doc",
                "config/locales",
                "config/initializers",
                "config/environments",
                "config/deploy",
                "db",
                "features",
                "lib",
                "log",
                "public",
                "script",
                "test",
                "tmp",
                "vendor",
                "spec/mailers",
                "spec/helpers"
            ],
            "file_exclude_patterns": [
                "README.rdoc",
                "Rakefile",
                "Gemfile.lock",
                "config.ru",
                "Capfile",
                ".rspec",
                "db/seeds.rb",
                "db/schema.rb",
                "config/application.rb",
                "config/boot.rb",
                "config/cucumber.yml",
                "config/database.yml",
                "config/environment.rb"
            ]
        },
        {"path": "db/migrate"}

    ]
}
Web Analytics