pagecord-cli 0.2.0 → 0.2.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 128d888cf41e5516fb1266253ff9bd277ac4975aabe4d703d55377b487742a9b
4
- data.tar.gz: f1eb62f81e6382bf02babcac836c3ea7f84e855235697950c58e91a3437b4bdb
3
+ metadata.gz: 5e79c8864b73579755f1699da00835d474cae8871b64c5ff21e091d4540e95be
4
+ data.tar.gz: bbdc8963f7317ec56f55de326898021d1bf5712f15c8833c83f6ccbac533f06f
5
5
  SHA512:
6
- metadata.gz: f392720b150de97d42b8e5d74bf231575e4c90a644653d3d1fb1748c09e1c5896a355be6afc51dbe001c6b95558729728d7387d9b6f66501a24b75b734cdc1f6
7
- data.tar.gz: 2c0b4fc00acfb25fbfdf5ef16f7c20a31f7dfb22c1a4886967561558555279fcf2b553706eb30df0cdac378b08fa8d355f9339639a87cb4491f81330a934e0bc
6
+ metadata.gz: b6dab32f1f4884be02388a220d441fbe21041940d5f3c4a6e607ce4c9ff4c60d12582ae9f60435cbcf87b3e3645f9fd58cc144a55b4b453bd2a9f628cde3c0a3
7
+ data.tar.gz: 208af262450558105da20a6006cf70340e804ad6c4fadf4dbab05aada82a572efd0f5af01cfd12cdec2d1b20511473407d00d5f87c51d1ae36e6b45bebbde3ef
data/README.md CHANGED
@@ -88,17 +88,19 @@ Fields: `--theme`, `--font`, `--width`, `--layout`, the six
88
88
 
89
89
  ```bash
90
90
  pagecord custom-code show --css > blog.css
91
- pagecord custom-code update --css @blog.css
91
+ pagecord custom-code update --css blog.css
92
92
  ```
93
93
 
94
- Fields: `--css`, `--footer-html`, `--head-html`, `--body-html`, and
95
- `--enabled true|false`. A value can be given literally, as `@path` to read a
96
- file, or as `@-` to read standard input:
94
+ `--css`, `--footer-html`, `--head-html` and `--body-html` each take the path to
95
+ a file holding that content, so you can keep all of it under version control:
97
96
 
98
97
  ```bash
99
- cat blog.css | pagecord custom-code update --css @-
98
+ pagecord custom-code update --css blog.css --footer-html footer.html
100
99
  ```
101
100
 
101
+ There is also `--enabled true|false` to switch your head and body code off
102
+ without deleting it.
103
+
102
104
  `custom-code show` prints JSON, or the raw field when you name one, so
103
105
  redirecting it to a file round-trips.
104
106
 
@@ -184,7 +184,7 @@ module PagecordCLI
184
184
  params = {}
185
185
  parser do |opts|
186
186
  CUSTOM_CODE_FIELDS.each do |flag, name|
187
- opts.on("--#{flag} VALUE") { |value| params[name] = read_value(value) }
187
+ opts.on("--#{flag} PATH") { |path| params[name] = read_file(flag, path) }
188
188
  end
189
189
  opts.on("--enabled BOOL", TrueClass) { |value| params["custom_code_enabled"] = value }
190
190
  end.parse!(argv)
@@ -266,14 +266,10 @@ module PagecordCLI
266
266
  )
267
267
  end
268
268
 
269
- def read_value(value)
270
- case value
271
- when "@-" then input.read
272
- when /\A@/ then File.read(value[1..])
273
- else value
274
- end
269
+ def read_file(flag, path)
270
+ File.read(path)
275
271
  rescue SystemCallError
276
- raise Error, "Could not read #{value[1..]}"
272
+ raise Error, path.match?(/[{<]/) ? "--#{flag} takes a file path, not the content itself" : "Could not read #{path}"
277
273
  end
278
274
 
279
275
  def say(message)
@@ -314,6 +310,7 @@ module PagecordCLI
314
310
  pagecord appearance show
315
311
  pagecord appearance update [options]
316
312
  pagecord custom-code show [--css|--footer-html|--head-html|--body-html]
313
+ pagecord custom-code update --css blog.css
317
314
  pagecord custom-code update [options]
318
315
  pagecord publish FILE [SUBDOMAIN] [options]
319
316
  pagecord draft FILE [SUBDOMAIN] [options]
@@ -339,10 +336,8 @@ module PagecordCLI
339
336
  --show-branding true|false
340
337
 
341
338
  Custom code options:
342
- --css, --footer-html, --head-html, --body-html
339
+ --css, --footer-html, --head-html, --body-html (each takes a file path)
343
340
  --enabled true|false
344
-
345
- Custom code values can be a literal, @path to read a file, or @- to read stdin.
346
341
  HELP
347
342
  0
348
343
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PagecordCLI
4
- VERSION = "0.2.0"
4
+ VERSION = "0.2.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pagecord-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Olly Headey