Skip to content
Permalink
Browse files

rename all the code

  • Loading branch information
rybit committed Mar 6, 2017
1 parent 2983bcc commit 77659903b14d7eb92637fc90eaeed6e255641819
@@ -6,7 +6,7 @@ help: ## Show this help.
all: test build ## Run the tests and build the binary.

build: ## Build the binary.
go build -ldflags "-X github.com/netlify/netlify-commerce/cmd.Version=`git rev-parse HEAD`"
go build -ldflags "-X github.com/netlify/gocommerce/cmd.Version=`git rev-parse HEAD`"

deps: ## Install dependencies.
go get -u github.com/Masterminds/glide && glide install
@@ -15,9 +15,9 @@ import (
"github.com/rs/cors"
"github.com/zenazn/goji/web/mutil"

"github.com/netlify/netlify-commerce/assetstores"
"github.com/netlify/netlify-commerce/conf"
"github.com/netlify/netlify-commerce/mailer"
"github.com/netlify/gocommerce/assetstores"
"github.com/netlify/gocommerce/conf"
"github.com/netlify/gocommerce/mailer"

paypalsdk "github.com/logpacker/PayPal-Go-SDK"
)
@@ -9,7 +9,7 @@ import (
"github.com/Sirupsen/logrus/hooks/test"
"github.com/stretchr/testify/assert"

"github.com/netlify/netlify-commerce/conf"
"github.com/netlify/gocommerce/conf"
)

func TestTraceWrapper(t *testing.T) {
@@ -7,7 +7,7 @@ import (
"github.com/dgrijalva/jwt-go"
"golang.org/x/net/context"

"github.com/netlify/netlify-commerce/conf"
"github.com/netlify/gocommerce/conf"
)

const (
@@ -9,8 +9,8 @@ import (
"time"

"github.com/guregu/kami"
"github.com/netlify/netlify-commerce/conf"
"github.com/netlify/netlify-commerce/models"
"github.com/netlify/gocommerce/conf"
"github.com/netlify/gocommerce/models"
"golang.org/x/net/context"
)

@@ -8,8 +8,8 @@ import (
"testing"

"github.com/guregu/kami"
"github.com/netlify/netlify-commerce/conf"
"github.com/netlify/netlify-commerce/models"
"github.com/netlify/gocommerce/conf"
"github.com/netlify/gocommerce/models"
"github.com/stretchr/testify/assert"
)

@@ -7,7 +7,7 @@ import (

"github.com/guregu/kami"
"github.com/jinzhu/gorm"
"github.com/netlify/netlify-commerce/models"
"github.com/netlify/gocommerce/models"
)

const MaxIPsPerDay = 50
@@ -13,8 +13,8 @@ import (
"github.com/guregu/kami"
"github.com/jinzhu/gorm"
"github.com/mattes/vat"
"github.com/netlify/netlify-commerce/calculator"
"github.com/netlify/netlify-commerce/models"
"github.com/netlify/gocommerce/calculator"
"github.com/netlify/gocommerce/models"
"github.com/pborman/uuid"
)

@@ -715,7 +715,7 @@ func (a *API) loadSettings(ctx context.Context) (*calculator.Settings, error) {
config := getConfig(ctx)

settings := &calculator.Settings{}
resp, err := a.httpClient.Get(config.SiteURL + "/netlify-commerce/settings.json")
resp, err := a.httpClient.Get(config.SiteURL + "/gocommerce/settings.json")
if err != nil {
return nil, fmt.Errorf("Error loading site settings: %v", err)
}
@@ -776,9 +776,9 @@ func (a *API) processLineItem(ctx context.Context, order *models.Order, item *mo
return err
}

metaTag := doc.Find(".netlify-commerce-product")
metaTag := doc.Find(".gocommerce-product")
if metaTag.Length() == 0 {
return fmt.Errorf("No script tag with id netlify-commerce-product tag found for '%v'", item.Title)
return fmt.Errorf("No script tag with id gocommerce-product tag found for '%v'", item.Title)
}
metaProducts := []*models.LineItemMetadata{}
var parsingErr error
@@ -13,8 +13,8 @@ import (
"github.com/jinzhu/gorm"
"github.com/stretchr/testify/assert"

"github.com/netlify/netlify-commerce/conf"
"github.com/netlify/netlify-commerce/models"
"github.com/netlify/gocommerce/conf"
"github.com/netlify/gocommerce/models"
)

// ------------------------------------------------------------------------------------------------
@@ -776,7 +776,7 @@ func startTestSite(config *conf.Configuration) {
<html>
<head><title>Test Product</title></head>
<body>
<script class="netlify-commerce-product">
<script class="gocommerce-product">
{"sku": "product-1", "title": "Product 1", "type": "Book", "prices": [
{"amount": "9.99", "currency": "USD"}
]}
@@ -788,7 +788,7 @@ func startTestSite(config *conf.Configuration) {
<html>
<head><title>Test Product</title></head>
<body>
<script class="netlify-commerce-product">
<script class="gocommerce-product">
{"sku": "product-1", "title": "Product 1", "type": "Book", "prices": [
{"amount": "9.99", "currency": "USD", "items": [
{"amount": "7.00", "type": "Book"},
@@ -798,7 +798,7 @@ func startTestSite(config *conf.Configuration) {
</script>
</body>
</html>`)
case "/netlify-commerce/settings.json":
case "/gocommerce/settings.json":
fmt.Fprintln(w, `{
"taxes": [
{"percentage": 19, "product_types": ["E-Book"], "countries": ["Germany"]},
@@ -8,7 +8,7 @@ import (
"time"

"github.com/jinzhu/gorm"
"github.com/netlify/netlify-commerce/models"
"github.com/netlify/gocommerce/models"
)

var sortFields = map[string]string{
@@ -10,12 +10,12 @@ import (
"github.com/guregu/kami"
"github.com/jinzhu/gorm"
"github.com/logpacker/PayPal-Go-SDK"
"github.com/pborman/uuid"
"github.com/stripe/stripe-go"
"github.com/stripe/stripe-go/charge"
"github.com/stripe/stripe-go/refund"

"github.com/netlify/netlify-commerce/models"
"github.com/pborman/uuid"
"github.com/netlify/gocommerce/models"
)

// MaxConcurrentLookups controls the number of simultaneous HTTP Order lookups
@@ -17,7 +17,7 @@ import (
"context"

"github.com/jinzhu/gorm"
"github.com/netlify/netlify-commerce/models"
"github.com/netlify/gocommerce/models"
)

// ------------------------------------------------------------------------------------------------
@@ -30,8 +30,8 @@ func (a *API) PaypalCreatePayment(ctx context.Context, w http.ResponseWriter, r
Currency: r.FormValue("currency"),
}
a.log.Infof("Creating paypal payment with profile %v: %v", profile, amount)
redirectURI := a.config.SiteURL + "/netlify-commerce/paypal"
cancelURI := a.config.SiteURL + "/netlify-commerce/paypal/cancel"
redirectURI := a.config.SiteURL + "/gocommerce/paypal"
cancelURI := a.config.SiteURL + "/gocommerce/paypal/cancel"
paymentResult, err := a.paypal.CreatePayment(paypalsdk.Payment{
Intent: "sale",
Payer: &paypalsdk.Payer{
@@ -80,7 +80,7 @@ func (a *API) getExperience() (*paypalsdk.WebProfile, error) {
}

for _, profile := range experiences {
if profile.Name == "netlify-commerce" {
if profile.Name == "gocommerce" {
paypalExperience.mutex.Lock()
paypalExperience.profile = &profile
paypalExperience.mutex.Unlock()
@@ -89,7 +89,7 @@ func (a *API) getExperience() (*paypalsdk.WebProfile, error) {
}

profile, err := a.paypal.CreateWebProfile(paypalsdk.WebProfile{
Name: "netlify-commerce",
Name: "gocommerce",
InputFields: paypalsdk.InputFields{
NoShipping: 1,
},
@@ -4,7 +4,7 @@ import (
"context"
"net/http"

"github.com/netlify/netlify-commerce/models"
"github.com/netlify/gocommerce/models"
)

type SalesRow struct {
@@ -12,7 +12,7 @@ import (
"github.com/jinzhu/gorm"
"github.com/pborman/uuid"

"github.com/netlify/netlify-commerce/models"
"github.com/netlify/gocommerce/models"
)

// UserList will return all of the users. It requires admin access.
@@ -12,7 +12,7 @@ import (
"github.com/guregu/kami"
"github.com/stretchr/testify/assert"

"github.com/netlify/netlify-commerce/models"
"github.com/netlify/gocommerce/models"
)

func TestUsersQueryForAllUsersAsStranger(t *testing.T) {
@@ -16,9 +16,9 @@ import (
"github.com/jinzhu/gorm"
"github.com/stretchr/testify/assert"

"github.com/netlify/netlify-commerce/calculator"
"github.com/netlify/netlify-commerce/conf"
"github.com/netlify/netlify-commerce/models"
"github.com/netlify/gocommerce/calculator"
"github.com/netlify/gocommerce/conf"
"github.com/netlify/gocommerce/models"
)

var dbFiles []string
@@ -3,7 +3,7 @@ package assetstores
import (
"fmt"

"github.com/netlify/netlify-commerce/conf"
"github.com/netlify/gocommerce/conf"
)

type Store interface {
@@ -2,8 +2,8 @@ package cmd

import (
"github.com/Sirupsen/logrus"
"github.com/netlify/netlify-commerce/conf"
"github.com/netlify/netlify-commerce/models"
"github.com/netlify/gocommerce/conf"
"github.com/netlify/gocommerce/models"
"github.com/spf13/cobra"
)

@@ -4,13 +4,13 @@ import (
"github.com/Sirupsen/logrus"
"github.com/spf13/cobra"

"github.com/netlify/netlify-commerce/conf"
"github.com/netlify/netlify-commerce/models"
"github.com/netlify/gocommerce/conf"
"github.com/netlify/gocommerce/models"
)

// rootCmd will run the log streamer
var rootCmd = cobra.Command{
Use: "netlify-commerce",
Use: "gocommerce",
Long: "A service that will validate restful transactions and send them to stripe.",
Run: func(cmd *cobra.Command, args []string) {
execWithConfig(cmd, serve)
@@ -4,11 +4,11 @@ import (
"fmt"

"github.com/Sirupsen/logrus"
"github.com/netlify/netlify-commerce/api"
"github.com/netlify/netlify-commerce/assetstores"
"github.com/netlify/netlify-commerce/conf"
"github.com/netlify/netlify-commerce/mailer"
"github.com/netlify/netlify-commerce/models"
"github.com/netlify/gocommerce/api"
"github.com/netlify/gocommerce/assetstores"
"github.com/netlify/gocommerce/conf"
"github.com/netlify/gocommerce/mailer"
"github.com/netlify/gocommerce/models"
"github.com/spf13/cobra"
stripe "github.com/stripe/stripe-go"

@@ -93,9 +93,8 @@ func Load(configFile string) (*Configuration, error) {
viper.SetConfigFile(configFile)
} else {
viper.SetConfigName("config")
viper.AddConfigPath("./") // ./config.[json | toml]
viper.AddConfigPath("$HOME/.gocommerce/") // ~/.gocommerce/config.[json | toml] // Keep the configuration backwards compatible
viper.AddConfigPath("$HOME/.netlify-commerce/") // ~/.netlify-commerce/config.[json | toml]
viper.AddConfigPath("./") // ./config.[json | toml]
viper.AddConfigPath("$HOME/.gocommerce/") // ~/.gocommerce/config.[json | toml] // Keep the configuration backwards compatible
}

viper.SetEnvPrefix("NETLIFY_COMMERCE")

0 comments on commit 7765990

Please sign in to comment.
You can’t perform that action at this time.