add bash driver again

This commit is contained in:
mattes 2014-08-12 03:20:28 +02:00
parent b3835d4bde
commit b545420127
4 changed files with 50 additions and 8 deletions

7
driver/bash/README.md Normal file
View File

@ -0,0 +1,7 @@
# Bash Driver
```
-url="bash://"
```
### @TODO

26
driver/bash/bash.go Normal file
View File

@ -0,0 +1,26 @@
package bash
import (
"github.com/mattes/migrate/file"
_ "github.com/mattes/migrate/migrate/direction"
)
type Driver struct {
}
func (driver *Driver) Initialize(url string) error {
return nil
}
func (driver *Driver) FilenameExtension() string {
return "sh"
}
func (driver *Driver) Migrate(files file.Files, pipe chan interface{}) {
defer close(pipe)
return
}
func (driver *Driver) Version() (uint64, error) {
return uint64(0), nil
}

9
driver/bash/bash_test.go Normal file
View File

@ -0,0 +1,9 @@
package bash
import (
"testing"
)
func TestFoobar(t *testing.T) {
}

View File

@ -3,7 +3,7 @@ package driver
import (
"errors"
"fmt"
// "github.com/mattes/migrate/driver/bash"
"github.com/mattes/migrate/driver/bash"
"github.com/mattes/migrate/driver/postgres"
"github.com/mattes/migrate/file"
neturl "net/url" // alias to allow `url string` func signature in New
@ -31,13 +31,13 @@ func New(url string) (Driver, error) {
return nil, err
}
return d, nil
// case "bash":
// d := &bash.Driver{}
// verifyFilenameExtension("bash", d)
// if err := d.Initialize(url); err != nil {
// return nil, err
// }
// return d, nil
case "bash":
d := &bash.Driver{}
verifyFilenameExtension("bash", d)
if err := d.Initialize(url); err != nil {
return nil, err
}
return d, nil
default:
return nil, errors.New(fmt.Sprintf("Driver '%s' not found.", u.Scheme))
}