guard/guard — pull request #378 by netzpirat (2012-12-19 14:57:58+00:00)
Title: Scope plugins and groups

This adds setting an initial plugin scope from the cli (in addition to the already existing group scope), shows the current scope in the interactor and let it change at runtime with the new `scope` (or `o` as shortcut).

But let's see it in action instead of this boring description:

```bash
$ bundle exec guard help start
-g, [--group=Run only the passed groups]
-P, [--plugin=Run only the passed plugins]
```

Yeah I know, but `-p` is already for polling. So now you can pass a plugin to scope the actions to, like

```bash
$ bundle exec guard -P ronn
[1] {ronn} guard(main)>
```

As you can see, the current scope is visible within the mustaches `{ronn}`. This means that the `change`, `run_all` and `reload` actions are globally scoped to to ronn and no other plugins are triggered:

```ruby
[1] {ronn} guard(main)> r
15:54:53 - INFO - Reload ronn
[2] {ronn} guard(main)>
```

but you can overwrite the global scope by providing a local scope:

```ruby
[2] {ronn} guard(main)> r rspec
15:55:20 - INFO - Reload rspec
[3] {ronn} guard(main)>
```

To change the scope, use the `scope` command or its shorthand `o`:

```ruby
[3] {ronn} guard(main)> o rspec
[4] {rspec} guard(main)>
```

To clear the scope, just call it without parameter:

```ruby
[4] {rspec} guard(main)> o
[5] guard(main)>
```

The same is true for groups:

```bash
$ bundle exec guard -g docs
[1] {Docs} guard(main)>
```

That's all. Happy scoping!