diff options
author | Icaro Perseo | 2017-01-05 15:43:24 -0600 |
---|---|---|
committer | Icaro Perseo | 2017-01-05 15:43:24 -0600 |
commit | 54da199efacfc81f3886a59301e9cba4d6ac5764 (patch) | |
tree | 6a9ae72429f26ae53fe5362d07f84ebc0ad16f31 | |
parent | a39dcffa62fc13f9181ca0a359c85a16cce8413c (diff) | |
download | aur-54da199efacfc81f3886a59301e9cba4d6ac5764.tar.gz |
Deprecation in Go CLI patch added. Minor shell output fixed.
-rw-r--r-- | .SRCINFO | 6 | ||||
-rw-r--r-- | PKGBUILD | 12 | ||||
-rw-r--r-- | cli-output.patch | 125 | ||||
-rw-r--r-- | cli_context-deprecated.patch | 119 |
4 files changed, 258 insertions, 4 deletions
@@ -1,7 +1,7 @@ pkgbase = dashing pkgdesc = A Dash Generator Script for Any HTML pkgver = 0.3.0 - pkgrel = 1 + pkgrel = 2 url = https://github.com/technosophos/dashing arch = i686 arch = x86_64 @@ -9,7 +9,11 @@ pkgbase = dashing makedepends = go makedepends = glide source = dashing-0.3.0.tar.gz::https://github.com/technosophos/dashing/archive/0.3.0.tar.gz + source = cli_context-deprecated.patch + source = cli-output.patch sha256sums = f6569f3df80c964c0482e7adc1450ea44532d8da887091d099ce42a908fc8136 + sha256sums = e0ec017227a3f8aa58095fbdfe18db3e5376e530b41b1d34164461c51623ac2b + sha256sums = c412b3b2ccae6193aee5989d131bc6e8df7c80eee305794e406dd020a44c1ccb pkgname = dashing @@ -2,17 +2,23 @@ pkgname=dashing pkgver=0.3.0 -pkgrel=1 +pkgrel=2 pkgdesc="A Dash Generator Script for Any HTML" url="https://github.com/technosophos/dashing" license=('MIT') arch=('i686' 'x86_64') makedepends=('go' 'glide') -source=(${pkgname}-${pkgver}.tar.gz::"https://github.com/technosophos/${pkgname}/archive/${pkgver}.tar.gz") -sha256sums=('f6569f3df80c964c0482e7adc1450ea44532d8da887091d099ce42a908fc8136') +source=(${pkgname}-${pkgver}.tar.gz::"https://github.com/technosophos/${pkgname}/archive/${pkgver}.tar.gz" + "cli_context-deprecated.patch" + "cli-output.patch") +sha256sums=('f6569f3df80c964c0482e7adc1450ea44532d8da887091d099ce42a908fc8136' + 'e0ec017227a3f8aa58095fbdfe18db3e5376e530b41b1d34164461c51623ac2b' + 'c412b3b2ccae6193aee5989d131bc6e8df7c80eee305794e406dd020a44c1ccb') prepare() { cd ${pkgname}-${pkgver} + patch -p1 -i ../cli_context-deprecated.patch + patch -p1 -i ../cli-output.patch export GOPATH=${srcdir}/${pkgname}-${pkgver} mkdir -p src mv dashing.go src/ diff --git a/cli-output.patch b/cli-output.patch new file mode 100644 index 000000000000..e14547869c9b --- /dev/null +++ b/cli-output.patch @@ -0,0 +1,125 @@ +--- b/dashing.go 2017-01-05 14:48:00.403357303 -0600 ++++ c/dashing.go 2017-01-05 15:32:17.327116746 -0600 +@@ -74,13 +74,8 @@ + // Transform structs. + type Transform struct { + Type string +- +- // Perform a replace operation on the text + Regexp *regexp.Regexp + Replacement string +- +- // Skip files that don't match this path +- MatchPath *regexp.Regexp + } + + var ignoreHash map[string]bool +@@ -128,7 +123,7 @@ + { + Name: "version", + Usage: "Print version and exit.", +- Action: func(c *cli.Context) error { fmt.Println(version);return nil }, ++ Action: func(c *cli.Context) { fmt.Println(version) }, + Flags: []cli.Flag{ + cli.StringFlag{ + Name: "config, f", +@@ -139,7 +134,7 @@ + } + } + +-func create(c *cli.Context) error { ++func create(c *cli.Context) { + f := c.String("config") + if len(f) == 0 { + f = "dashing.json" +@@ -160,14 +155,14 @@ + } + err = ioutil.WriteFile(f, j, 0755) + if err != nil { +- fmt.Errorf("Could not initialize JSON file: %s", err) ++ fmt.Errorf("Could not initialize JSON file: %s\n", err) + os.Exit(1) + } +- fmt.Printf("You may now edit %s", f) +- return nil ++ fmt.Printf("You may now edit %s\n", f) ++ + } + +-func build(c *cli.Context) error { ++func build(c *cli.Context) { + var dashing Dashing + + source_depth := 0 +@@ -212,11 +207,10 @@ + db, err := createDB(name) + if err != nil { + fmt.Printf("Failed to create database: %s\n", err) +- return nil ++ return + } + defer db.Close() + texasRanger(source, source_depth, name, dashing, db) +- return nil + } + + func decodeSelectField(d *Dashing) error { +@@ -230,37 +224,30 @@ + } + } else if rv.Kind() == reflect.Map { + val := val.(map[string]interface{}) +- var ttype, trep string +- var creg, cmatchpath *regexp.Regexp +- var err error +- +- if r, ok := val["type"]; ok { +- ttype = r.(string) ++ var ttype, treg, trep string ++ if t, ok := val["type"]; ok { ++ ttype = t.(string) + } + if r, ok := val["regexp"]; ok { +- creg, err = regexp.Compile(r.(string)) +- if err != nil { +- return fmt.Errorf("failed to compile regexp '%s': %s", r.(string), err) +- } ++ treg = r.(string) + } + if r, ok := val["replacement"]; ok { + trep = r.(string) + } +- if r, ok := val["matchpath"]; ok { +- cmatchpath, err = regexp.Compile(r.(string)) +- if err != nil { +- return fmt.Errorf("failed to compile regexp '%s': %s", r.(string), err) ++ var creg *regexp.Regexp ++ var err error ++ if len(treg) > 0 { ++ if creg, err = regexp.Compile(treg); err != nil { ++ return fmt.Errorf("failed to compile regexp '%s': %s", treg, err) + } + } + trans = &Transform{ + Type: ttype, + Regexp: creg, + Replacement: trep, +- MatchPath: cmatchpath, + } + } else { + fmt.Errorf("Expected string or map. Kind is %s.", rv.Kind().String()) +- return nil + } + d.selectors[sel] = trans + } +@@ -454,11 +441,6 @@ + } + + for pattern, sel := range dashing.selectors { +- // Skip this selector if file path doesn't match +- if sel.MatchPath != nil && ! sel.MatchPath.MatchString(path) { +- continue +- } +- + m := css.MustCompile(pattern) + found := m.MatchAll(top) + for _, n := range found { diff --git a/cli_context-deprecated.patch b/cli_context-deprecated.patch new file mode 100644 index 000000000000..f082eb23301d --- /dev/null +++ b/cli_context-deprecated.patch @@ -0,0 +1,119 @@ +--- a/dashing.go 2015-12-31 15:38:22.000000000 -0600 ++++ b/dashing.go 2017-01-05 14:48:00.403357303 -0600 +@@ -74,8 +74,13 @@ + // Transform structs. + type Transform struct { + Type string ++ ++ // Perform a replace operation on the text + Regexp *regexp.Regexp + Replacement string ++ ++ // Skip files that don't match this path ++ MatchPath *regexp.Regexp + } + + var ignoreHash map[string]bool +@@ -123,7 +128,7 @@ + { + Name: "version", + Usage: "Print version and exit.", +- Action: func(c *cli.Context) { fmt.Println(version) }, ++ Action: func(c *cli.Context) error { fmt.Println(version);return nil }, + Flags: []cli.Flag{ + cli.StringFlag{ + Name: "config, f", +@@ -134,7 +139,7 @@ + } + } + +-func create(c *cli.Context) { ++func create(c *cli.Context) error { + f := c.String("config") + if len(f) == 0 { + f = "dashing.json" +@@ -159,10 +164,10 @@ + os.Exit(1) + } + fmt.Printf("You may now edit %s", f) +- ++ return nil + } + +-func build(c *cli.Context) { ++func build(c *cli.Context) error { + var dashing Dashing + + source_depth := 0 +@@ -207,10 +212,11 @@ + db, err := createDB(name) + if err != nil { + fmt.Printf("Failed to create database: %s\n", err) +- return ++ return nil + } + defer db.Close() + texasRanger(source, source_depth, name, dashing, db) ++ return nil + } + + func decodeSelectField(d *Dashing) error { +@@ -224,30 +230,37 @@ + } + } else if rv.Kind() == reflect.Map { + val := val.(map[string]interface{}) +- var ttype, treg, trep string +- if t, ok := val["type"]; ok { +- ttype = t.(string) ++ var ttype, trep string ++ var creg, cmatchpath *regexp.Regexp ++ var err error ++ ++ if r, ok := val["type"]; ok { ++ ttype = r.(string) + } + if r, ok := val["regexp"]; ok { +- treg = r.(string) ++ creg, err = regexp.Compile(r.(string)) ++ if err != nil { ++ return fmt.Errorf("failed to compile regexp '%s': %s", r.(string), err) ++ } + } + if r, ok := val["replacement"]; ok { + trep = r.(string) + } +- var creg *regexp.Regexp +- var err error +- if len(treg) > 0 { +- if creg, err = regexp.Compile(treg); err != nil { +- return fmt.Errorf("failed to compile regexp '%s': %s", treg, err) ++ if r, ok := val["matchpath"]; ok { ++ cmatchpath, err = regexp.Compile(r.(string)) ++ if err != nil { ++ return fmt.Errorf("failed to compile regexp '%s': %s", r.(string), err) + } + } + trans = &Transform{ + Type: ttype, + Regexp: creg, + Replacement: trep, ++ MatchPath: cmatchpath, + } + } else { + fmt.Errorf("Expected string or map. Kind is %s.", rv.Kind().String()) ++ return nil + } + d.selectors[sel] = trans + } +@@ -441,6 +454,11 @@ + } + + for pattern, sel := range dashing.selectors { ++ // Skip this selector if file path doesn't match ++ if sel.MatchPath != nil && ! sel.MatchPath.MatchString(path) { ++ continue ++ } ++ + m := css.MustCompile(pattern) + found := m.MatchAll(top) + for _, n := range found { |