danielbrodin/atom-project-manager — pull request #53 by alvaromartin (2014-11-14 09:24:39+00:00)
Title: Some bugs fixed

Hi, thanks for this package! It's made my life a lot easier :)

I had to modify a couple of things to make `atom-project-manager` work for me.

Here are the issues fixed:

# Existential Operator

https://github.com/danielbrodin/atom-project-manager/blob/master/lib/project-manager.coffee#L99
```
for path in project.paths?
```

in coffeescript transpiles to

```
var a, paths, _i, _len, _ref;
_ref = project.paths != null;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
paths = _ref[_i];
}
```

which means the for loop was never being executed because of

```
_ref = project.paths != null;
```

I wrote a fix and a test spec to avoid regressions

# Project settings were not loading

Once I fixed the issue above, settings were still not loading for me.

I tried loading a very simple configuration setting for tree-view

```
'settings':
'tree-view':
'showOnRightSide': false
```

Also tried `'tree-view.showOnRightSide': false`

I read the code and it was happening because of

https://github.com/danielbrodin/atom-project-manager/blob/master/lib/project-manager.coffee#L104
```
enableSettings: (settings) ->
_ = require 'underscore-plus'
projectSettings = {}
for setting, value of settings
_.setValueForKeyPath(projectSettings, setting, value)
atom.config.settings = _.deepExtend(
projectSettings,
atom.config.settings)
atom.config.emit('updated')
```

extending `atom.config.settings` like that was not enough. I had to use `atom.config.setRawValue` for each key. After the fix, my tree-view was updated and positioned correctly.

I also added a fix and tests for this issue.

# Project settings were not loading when using project toggle

Once I fixed the issue above, settings were still not loading when I opened projects using "project manager: toggle" command. I'd had to execute "project manager: reload settings" after selecting the project.

The issue was that,

https://github.com/danielbrodin/atom-project-manager/blob/master/lib/project-manager.coffee#L120

```
openProject: ({title, paths, devMode}) ->
atom.open options =
pathsToOpen: paths
devMode: devMode
```

Was never loading project settings. So I made sure we call `loadCurrentProject` in that function

I also added a fix and tests for this.

# A test was failing

You were using `ProjectManager.file` instead of `ProjectManager.file()` in your spec test