Skip to content

Commit 1b61252

Browse files
authored
Merge pull request #17 from writeas/include-cli
Embed CLI
2 parents 42102a5 + 0e912b3 commit 1b61252

File tree

121 files changed

+30170
-4
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

121 files changed

+30170
-4
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
build
55
.ninja_*
66
build.ninja
7+
data/writeas

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "src/github.com/writeas/writeas-cli"]
2+
path = src/github.com/writeas/writeas-cli
3+
url = https://github.com/writeas/writeas-cli.git

build-cli.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
exec_name=writeas
4+
5+
echo "Building $exec_name CLI..."
6+
gb build github.com/writeas/writeas-cli/cmd/writeas
7+
echo "Success."

data/meson.build

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,3 @@ install_data('com.github.writeas.writeas-gtk.desktop',
1515
install_dir: join_paths(get_option('datadir'), 'applications'))
1616
install_data('com.github.writeas.writeas-gtk.appdata.xml',
1717
install_dir: join_paths(get_option('datadir'), 'metainfo'))
18-
install_data('writeas', install_dir: get_option('bindir'))

data/writeas

-7.83 MB
Binary file not shown.

debian/control

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@ Build-Depends: meson,
66
debhelper (>= 9),
77
libgtk-3-dev,
88
libgtksourceview-3.0-dev,
9-
valac (>= 0.36)
9+
valac (>= 0.36),
10+
golang-go,
11+
gb
1012
Standards-Version: 3.9.3
1113

1214
Package: com.github.writeas.writeas-gtk
1315
Architecture: any
14-
Depends: ${misc:Depends}, ${shlibs:Depends}, writeas-cli
16+
Depends: ${misc:Depends}, ${shlibs:Depends}
1517
Recommends: fonts-lora, fonts-open-sans, fonts-hack
1618
Description: A distraction free and private writing tool, with built-in publishing.

debian/rules

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,12 @@ override_dh_auto_configure:
2222
cd debian/build && meson --prefix=/usr ../..
2323

2424
override_dh_auto_build:
25-
cd debian/build && ninja -v
25+
cd debian/build && ninja -v && ninja build
2626

2727
override_dh_auto_test:
2828
cd debian/build && ninja test
2929

3030
override_dh_auto_install:
3131
cd debian/build && DESTDIR=${CURDIR}/debian/com.github.writeas.writeas-gtk ninja install
32+
mkdir -p debian/com.github.writeas.writeas-gtk/usr/bin
33+
cp bin/writeas debian/com.github.writeas.writeas-gtk/usr/bin/

meson.build

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,7 @@ conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
99
configure_file(output: 'config.h', configuration: conf)
1010
config_h_dir = include_directories('.')
1111

12+
run_target('build', command: 'build-cli.sh')
13+
1214
subdir('data')
1315
subdir('src')

src/code.as/core/socks/LICENSE

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
Copyright (c) 2012, Hailiang Wang. All rights reserved.
2+
3+
Redistribution and use in source and binary forms, with or without modification,
4+
are permitted provided that the following conditions are met:
5+
6+
* Redistributions of source code must retain the above copyright notice, this
7+
list of conditions and the following disclaimer.
8+
9+
* Redistributions in binary form must reproduce the above copyright notice,
10+
this list of conditions and the following disclaimer in the documentation
11+
and/or other materials provided with the distribution.
12+
13+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
14+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
15+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
16+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
17+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
19+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
20+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
21+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
22+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

src/code.as/core/socks/README.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
SOCKS
2+
=====
3+
4+
[![GoDoc](https://godoc.org/code.as/core/socks?status.svg)](https://godoc.org/code.as/core/socks)
5+
6+
SOCKS is a SOCKS4, SOCKS4A and SOCKS5 proxy package for Go, forked from [h12w/socks](https://github.com/h12w/socks) and patched so it's `go get`able.
7+
8+
## Quick Start
9+
### Get the package
10+
11+
go get -u "code.as/core/socks"
12+
13+
### Import the package
14+
15+
import "code.as/core/socks"
16+
17+
### Create a SOCKS proxy dialing function
18+
19+
dialSocksProxy := socks.DialSocksProxy(socks.SOCKS5, "127.0.0.1:1080")
20+
tr := &http.Transport{Dial: dialSocksProxy}
21+
httpClient := &http.Client{Transport: tr}
22+
23+
## Example
24+
25+
```go
26+
package main
27+
28+
import (
29+
"fmt"
30+
"io/ioutil"
31+
"log"
32+
"net/http"
33+
34+
"code.as/core/socks"
35+
)
36+
37+
func main() {
38+
dialSocksProxy := socks.DialSocksProxy(socks.SOCKS5, "127.0.0.1:1080")
39+
tr := &http.Transport{Dial: dialSocksProxy}
40+
httpClient := &http.Client{Transport: tr}
41+
resp, err := httpClient.Get("http://www.google.com")
42+
if err != nil {
43+
log.Fatal(err)
44+
}
45+
defer resp.Body.Close()
46+
if resp.StatusCode != http.StatusOK {
47+
log.Fatal(resp.StatusCode)
48+
}
49+
buf, err := ioutil.ReadAll(resp.Body)
50+
if err != nil {
51+
log.Fatal(err)
52+
}
53+
fmt.Println(string(buf))
54+
}
55+
```
56+
57+
## Alternatives
58+
http://godoc.org/golang.org/x/net/proxy

0 commit comments

Comments
 (0)