Skip to content
This repository has been archived by the owner on Aug 9, 2021. It is now read-only.

Commit

Permalink
Merge d7741ee into 8ee390c
Browse files Browse the repository at this point in the history
  • Loading branch information
AnalogJ authored Aug 22, 2018
2 parents 8ee390c + d7741ee commit e8683de
Show file tree
Hide file tree
Showing 16 changed files with 342 additions and 246 deletions.
55 changes: 55 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# How to contribute

Thanks! There are tons of different programming languages & SCM's, making it difficult to develop and keep everything up
to date. We want to keep it as easy as possible to
contribute to `capsulecd`, so that you can automate package management for your favorite language.
There are a few guidelines that we need contributors to follow so that
we can keep on top of things.

## Getting Started

Fork, then clone the repo:

$ git clone git@github.com:your-username/capsulecd.git

Ensure you have docker installed.

$ docker version
Client:
Version: 18.06.0-ce
API version: 1.38
Go version: go1.10.3
Git commit: 0ffa825
Built: Wed Jul 18 19:05:26 2018
OS/Arch: darwin/amd64
Experimental: false

Server:
Engine:
Version: 18.06.0-ce
API version: 1.38 (minimum version 1.12)
Go version: go1.10.3
Git commit: 0ffa825
Built: Wed Jul 18 19:13:46 2018
OS/Arch: linux/amd64
Experimental: true

Build the CapsuleCD docker development environment:

$ docker build -f Dockerfile.build --tag capsulecd-development .

Run the docker development environment

$ docker run --rm -it -v `pwd`:/go/src/capsulecd capsulecd-development /scripts/development.sh

Now we should be inside the development container. Lets run the test suite.

$ go test -v -tags "static" $(glide novendor)

Once you've validated that the test suite has passed, you can now begin making changes to the capsulecd source.

# Adding a SCM

$ go test -v -tags "static" pkg/scm/scm_github_test.go

# Adding an Engine ()Language/Package Manager)
1 change: 1 addition & 0 deletions Dockerfile.build
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
&& go get github.com/Masterminds/glide

COPY ./ci/capsulecd.sh /scripts/capsulecd.sh
COPY ./ci/development.sh /scripts/development.sh

RUN /scripts/capsulecd.sh
7 changes: 2 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,12 +195,9 @@ CircleCI is used for continuous integration testing: <https://circleci.com/gh/An

# Contributing

If you'd like to help improve CapsuleCD, clone the project with Git and install dependencies by running:
If you'd like to help improve CapsuleCD, follow the instructions in [CONTRIBUTING.md](CONTRIBUTING.md)

$ git clone git://github.com/AnalogJ/capsulecd
$ glide install

Note for development you'll also need to ensure that you have the `git2go` dependencies installed on your machine.
Note that if you would like to do development without Docker, you'll also need to ensure that you have the `git2go` dependencies installed on your machine.
You can install these dependencies by using your system's package manager.

- openssl
Expand Down
14 changes: 14 additions & 0 deletions ci/development.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env bash

# instructions taken from capsule.yml (we only care about a linux development environment right now)
cd /go/src/capsulecd
rm -rf vendor
glide install

mkdir -p vendor/gopkg.in/libgit2/git2go.v25/vendor/libgit2/build/
cp /usr/local/linux/lib/pkgconfig/libgit2.pc vendor/gopkg.in/libgit2/git2go.v25/vendor/libgit2/build/libgit2.pc
. /scripts/toolchains/linux/linux-build-env.sh

export DEV_MODE=true

/bin/bash
2 changes: 1 addition & 1 deletion example.capsule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ npm_auth_token: ''

# Specifies the PYPI credentials to use when creating public release for Pypi package
# found in ~/.pypirc on developer machine
pypi_repository: 'https://upload.pypi.org/legacy/'
pypi_repository: 'https://pypi.python.org/pypi'
pypi_username: ''
pypi_password: ''

Expand Down
5 changes: 4 additions & 1 deletion pkg/config/interface.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
package config
import (
"github.com/spf13/viper"
)

// Create mock using:
// mockgen -source=pkg/config/interface.go -destination=pkg/config/mock/mock_config.go
Expand All @@ -15,5 +18,5 @@ type Interface interface {
GetString(key string) string
GetStringSlice(key string) []string
GetBase64Decoded(key string) (string, error)
UnmarshalKey(key string, rawVal interface{}) error
UnmarshalKey(key string, rawVal interface{}, decoder ...viper.DecoderConfigOption) error
}
116 changes: 62 additions & 54 deletions pkg/config/mock/mock_config.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/engine/engine_python.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func (g *enginePython) Init(pipelineData *pipeline.Data, config config.Interface
g.NextMetadata = new(pythonMetadata)

//set command defaults (can be overridden by repo/system configuration)
g.Config.SetDefault("pypi_repository", "https://upload.pypi.org/legacy/")
g.Config.SetDefault("pypi_repository", "https://pypi.python.org/pypi")
g.Config.SetDefault("engine_cmd_compile", "echo 'skipping compile'")
g.Config.SetDefault("engine_cmd_lint", "find . -name '*.py' -exec pylint -E '{}' +")
g.Config.SetDefault("engine_cmd_fmt", "find . -name '*.py' -exec pylint -E '{}' +") //TODO: replace with pycodestyle/pep8
Expand Down
2 changes: 1 addition & 1 deletion pkg/engine/engine_python_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func TestEnginePython_Create(t *testing.T) {
//assert
require.NoError(t, err)
require.NotNil(t, pythonEngine)
require.Equal(t, "https://upload.pypi.org/legacy/", testConfig.GetString("pypi_repository"), "should load engine defaults")
require.Equal(t, "https://pypi.python.org/pypi", testConfig.GetString("pypi_repository"), "should load engine defaults")
}

// Define the suite, and absorb the built-in basic suite
Expand Down
Loading

0 comments on commit e8683de

Please sign in to comment.