pagecord-cli 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +16 -13
- data/lib/pagecord_cli/cli.rb +5 -6
- data/lib/pagecord_cli/client.rb +9 -1
- data/lib/pagecord_cli/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 99eebd4d84788c1c5176bca0d7b1f036bb54ec2acb9e5f6a9f9fef7b63fc5d1d
|
|
4
|
+
data.tar.gz: 78d6e0b1623c066f1b9f992cf87e7e80c997ef7abfa2d2f4e6893ba6e34c0f8f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 27842bcc27c07553c69ee4664aad327ab1d1f6155b3eaccc64d66fbcc699d73d543ae09bf2b406f568e6fca1eab83e0976d8f0ed08f62bd30ec63f57e5836796
|
|
7
|
+
data.tar.gz: 245f7e50410b5b93daca45d14ead9268f447cd9bada1bf580db1c73d3c5ec5d39207f7dacbf09fb21c98cc2debfba5d0b97f39b8e3b931b2d183dee9ead935cd
|
data/README.md
CHANGED
|
@@ -22,7 +22,7 @@ The name should be your Pagecord subdomain. The API key is stored in
|
|
|
22
22
|
For local testing there is an undocumented `--base-url` option:
|
|
23
23
|
|
|
24
24
|
```bash
|
|
25
|
-
pagecord login myblog --base-url http://localhost:3000
|
|
25
|
+
pagecord login myblog --base-url http://api.localhost:3000
|
|
26
26
|
```
|
|
27
27
|
|
|
28
28
|
## Publishing
|
|
@@ -42,13 +42,6 @@ pagecord draft notes/idea.md
|
|
|
42
42
|
The first publish creates a post and writes Pagecord metadata back into the
|
|
43
43
|
file. Later publishes update the same post.
|
|
44
44
|
|
|
45
|
-
If you have one blog configured, `publish`, `draft`, and `logout` can omit the
|
|
46
|
-
subdomain. If you have more than one, pass the subdomain as the final argument:
|
|
47
|
-
|
|
48
|
-
```bash
|
|
49
|
-
pagecord publish hello.md myblog
|
|
50
|
-
```
|
|
51
|
-
|
|
52
45
|
See configured blogs:
|
|
53
46
|
|
|
54
47
|
```bash
|
|
@@ -63,16 +56,26 @@ pagecord logout myblog
|
|
|
63
56
|
|
|
64
57
|
## Choosing a blog
|
|
65
58
|
|
|
66
|
-
With
|
|
59
|
+
With one blog configured, every command uses it. With several, set a default
|
|
60
|
+
once:
|
|
67
61
|
|
|
68
62
|
```bash
|
|
69
63
|
pagecord blog use myblog
|
|
70
64
|
```
|
|
71
65
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
66
|
+
or name the blog on the command line:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
pagecord appearance show --blog myblog
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
`--blog` wins over the `PAGECORD_BLOG` environment variable, which wins over
|
|
73
|
+
the default. `publish`, `draft` and `logout` also take the subdomain as a
|
|
74
|
+
trailing argument, which wins over all three:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
pagecord publish hello.md myblog
|
|
78
|
+
```
|
|
76
79
|
|
|
77
80
|
## Appearance
|
|
78
81
|
|
data/lib/pagecord_cli/cli.rb
CHANGED
|
@@ -247,12 +247,12 @@ module PagecordCLI
|
|
|
247
247
|
end
|
|
248
248
|
|
|
249
249
|
def resolve_blog(name = nil)
|
|
250
|
-
raise Error, "No blogs are configured. Run pagecord login SUBDOMAIN first." if config.blogs.empty?
|
|
250
|
+
raise Error, "No blogs are configured. Run `pagecord login SUBDOMAIN` first." if config.blogs.empty?
|
|
251
251
|
|
|
252
252
|
subdomain = name || options[:blog] || ENV["PAGECORD_BLOG"] || config.default_blog ||
|
|
253
253
|
(config.blogs.keys.first if config.blogs.size == 1)
|
|
254
254
|
|
|
255
|
-
raise Error, "
|
|
255
|
+
raise Error, "Several blogs are configured. Pass `--blog SUBDOMAIN`, or run `pagecord blog use SUBDOMAIN` to set a default." unless subdomain
|
|
256
256
|
raise Error, "Unknown blog: #{subdomain}" unless config.blog(subdomain)
|
|
257
257
|
|
|
258
258
|
subdomain
|
|
@@ -310,15 +310,14 @@ module PagecordCLI
|
|
|
310
310
|
pagecord appearance show
|
|
311
311
|
pagecord appearance update [options]
|
|
312
312
|
pagecord custom-code show [--css|--footer-html|--head-html|--body-html]
|
|
313
|
-
pagecord custom-code update --css blog.css
|
|
314
313
|
pagecord custom-code update [options]
|
|
315
314
|
pagecord publish FILE [SUBDOMAIN] [options]
|
|
316
315
|
pagecord draft FILE [SUBDOMAIN] [options]
|
|
317
316
|
|
|
318
317
|
Global options:
|
|
319
|
-
--blog SUBDOMAIN
|
|
320
|
-
--json
|
|
321
|
-
--quiet
|
|
318
|
+
--blog SUBDOMAIN which blog to act on
|
|
319
|
+
--json machine-readable output
|
|
320
|
+
--quiet suppress confirmation messages
|
|
322
321
|
|
|
323
322
|
Publish options:
|
|
324
323
|
--title TITLE
|
data/lib/pagecord_cli/client.rb
CHANGED
|
@@ -80,7 +80,15 @@ module PagecordCLI
|
|
|
80
80
|
|
|
81
81
|
def request(http_request)
|
|
82
82
|
http_request["Authorization"] ||= "Bearer #{api_key}"
|
|
83
|
-
|
|
83
|
+
uri = http_request.uri
|
|
84
|
+
address = uri.hostname
|
|
85
|
+
if address.end_with?(".localhost")
|
|
86
|
+
# *.localhost is loopback by definition (RFC 6761); macOS does not resolve it
|
|
87
|
+
http_request["Host"] = "#{uri.host}:#{uri.port}"
|
|
88
|
+
address = "127.0.0.1"
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
response = Net::HTTP.start(address, uri.port, use_ssl: uri.scheme == "https") do |http|
|
|
84
92
|
http.open_timeout = OPEN_TIMEOUT
|
|
85
93
|
http.read_timeout = READ_TIMEOUT
|
|
86
94
|
http.write_timeout = WRITE_TIMEOUT if http.respond_to?(:write_timeout=)
|
data/lib/pagecord_cli/version.rb
CHANGED