Skip to content

Commit

Permalink
refactor(satisphp): decoupling satis dep, now the exec just needs to …
Browse files Browse the repository at this point in the history
…be in your path
  • Loading branch information
benschw committed Dec 10, 2014
1 parent e91e655 commit d4dbb17
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 33 deletions.
6 changes: 4 additions & 2 deletions Makefile
Expand Up @@ -12,9 +12,11 @@ deps:
go get
go get gopkg.in/check.v1

satis:
satis-install:
curl -sS https://getcomposer.org/installer | php
php ./composer.phar create-project composer/satis lib/satis --stability=dev --keep-vcs
php ./composer.phar create-project composer/satis /opt/satis --stability=dev --keep-vcs
ln -s /opt/satis/bin/satis /usr/local/bin/satis
rm ./composer.phar

admin-ui:
wget -qO- -O tmp.zip https://drone.io/github.com/benschw/satis-admin/files/admin-ui.zip
Expand Down
21 changes: 11 additions & 10 deletions README.md
Expand Up @@ -18,22 +18,23 @@ Some Highlights:

## Install

# Setup install dir
mkdir /opt/satis

# Get/Install Satis binary
# Get Composer/Satis and install in path
apt-get install -y php5-cli
curl -sS https://getcomposer.org/installer | php
php ./composer.phar create-project composer/satis /opt/satis/satis --stability=dev --keep-vcs
php ./composer.phar create-project composer/satis /opt/satis --stability=dev --keep-vcs
ln -s /opt/satis/bin/satis /usr/local/bin/satis

# Setup install dir
mkdir /opt/satis-go

# Get/Install satis-go server
wget -qO- -O /opt/satis/satis-go https://drone.io/github.com/benschw/satis-go/files/satis-go
chmod +x /opt/satis/satis-go
wget -qO- -O /opt/satis/config.yaml https://drone.io/github.com/benschw/satis-go/files/config.yaml
wget -qO- -O /opt/satis-go/satis-go https://drone.io/github.com/benschw/satis-go/files/satis-go
chmod +x /opt/satis-go/satis-go
wget -qO- -O /opt/satis-go/config.yaml https://drone.io/github.com/benschw/satis-go/files/config.yaml

# Get/Install ui for satis-go server
wget -qO- -O tmp.zip https://drone.io/github.com/benschw/satis-admin/files/admin-ui.zip
unzip tmp.zip -d /opt/satis/
unzip tmp.zip -d /opt/satis-go/

# Cleanup
rm ./composer.phar
Expand All @@ -44,7 +45,7 @@ Some Highlights:

### Start the server

/opt/satis/satis-go
/opt/satis-go/satis-go

### Manage your satis repo

Expand Down
1 change: 0 additions & 1 deletion config-local.yaml
@@ -1,6 +1,5 @@
bind: localhost:8080
dbpath: ./data
satispath: ./lib/satis
repouipath: ./repo-ui
adminuipath: ./admin-ui
reponame: My Repository
Expand Down
7 changes: 3 additions & 4 deletions config.yaml
@@ -1,7 +1,6 @@
bind: localhost:8080
dbpath: /opt/satis/data
satispath: /opt/satis/satis
repouipath: /opt/satis/repo-ui
adminuipath: /opt/satis/admin-ui
dbpath: /opt/satis-go/data
repouipath: /opt/satis-go/repo-ui
adminuipath: /opt/satis-go/admin-ui
reponame: My Satis-go
repohost: http://localhost:8080
2 changes: 0 additions & 2 deletions main.go
Expand Up @@ -14,7 +14,6 @@ import (
type Config struct {
Dbpath string
Bind string
Satispath string
RepoUiPath string
AdminUiPath string
Reponame string
Expand Down Expand Up @@ -66,7 +65,6 @@ func main() {
DbPath: cfg.Dbpath,
AdminUiPath: cfg.AdminUiPath,
WebPath: cfg.RepoUiPath,
SatisPath: cfg.Satispath,
Bind: cfg.Bind,
Name: cfg.Reponame,
Homepage: cfg.Repohost,
Expand Down
7 changes: 3 additions & 4 deletions satis/satisphp/static_generator.go
Expand Up @@ -13,15 +13,14 @@ type Generator interface {
}

type StaticWebGenerator struct {
DbPath string
SatisPath string
WebPath string
DbPath string
WebPath string
}

func (s *StaticWebGenerator) Generate() error {
log.Print("Generating...")
_, err := exec.
Command(s.SatisPath+"/bin/satis", "build", s.DbPath+db.StagingFile, s.WebPath).
Command("satis", "--no-interaction", "build", s.DbPath+db.StagingFile, s.WebPath).
Output()

return err
Expand Down
6 changes: 2 additions & 4 deletions satis/server.go
Expand Up @@ -16,7 +16,6 @@ type Server struct {
DbPath string
AdminUiPath string
WebPath string
SatisPath string
Bind string
Name string
Homepage string
Expand All @@ -35,9 +34,8 @@ func (s *Server) Run() error {

// Job Processor responsible for interacting with db & static web docs
gen := &satisphp.StaticWebGenerator{
DbPath: s.DbPath,
SatisPath: s.SatisPath,
WebPath: s.WebPath,
DbPath: s.DbPath,
WebPath: s.WebPath,
}

s.jobProcessor = satisphp.SatisJobProcessor{
Expand Down
11 changes: 5 additions & 6 deletions satis/server_test.go
Expand Up @@ -195,12 +195,11 @@ func ARandomServer() *Server {
}

s := &Server{
DbPath: dbPath,
WebPath: "../test-web/",
SatisPath: "../lib/satis",
Bind: host,
Name: "My Repo",
Homepage: fmt.Sprintf("http://%s", host),
DbPath: dbPath,
WebPath: "../test-web/",
Bind: host,
Name: "My Repo",
Homepage: fmt.Sprintf("http://%s", host),
}

go s.Run()
Expand Down

0 comments on commit d4dbb17

Please sign in to comment.