demotape 0.0.4 → 0.0.6

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: b7a68e716ef2ec6d5115371bc0e836e25cbe4e19b20e2c3d7d514b4909dafa6a
4
- data.tar.gz: 989fb3ed0c2ad24c30dbedcf706d6d4b51475e58796bfd1dfd8bef6ca6710a7c
3
+ metadata.gz: e3798bd4179968cb52b8665fee05eb4195be7ec98898bb1bbfd881f44f79c59d
4
+ data.tar.gz: 714db5cf0c410162b7aff172f6b4b1175ff3cfff4e3e001943429a53dd7ac372
5
5
  SHA512:
6
- metadata.gz: 58bc92cd8ce53899ddcd6a56e24113697987b1ae6b9ea71edf5c05e3a1f1560c412c66c4306a67cc3f13769169fdd1fa2c591fbbdca4d09ccd27a54c5deb69b3
7
- data.tar.gz: 18f8f3cd2420a788b527677da604aa0b68bdd9aa99755981a01e378a3fdb7592c4582916969b9814714daec45b40832afb481e06ce1b7d0b01a7d22c9e6d0889
6
+ metadata.gz: 2fc9f8b39e9c07ece1effff7b412242d64c31af62e0a9e33011556f390c0e2a15ec0f51005250dbf7eaa8799b47ac07cf533695447271fa197b6501ea4102a53
7
+ data.tar.gz: 96125fe7e9ddf9a702b4857ec4780776fb98c4d971110d7a4ac9e9cf30f04f67745ad0c07ca733108655c244e0efbad48a0c13a99eace8e52802547c6d050adc
data/CHANGELOG.md CHANGED
@@ -11,6 +11,19 @@ Prefix your message with one of the following:
11
11
  - [Security] in case of vulnerabilities.
12
12
  -->
13
13
 
14
+ ## v0.0.6
15
+
16
+ - [Added] Add `demotape run --working-dir` to specify the working directory for
17
+ commands. Notice that this changes all path references to be relative to the
18
+ working directory, including `--output-path` (if it's a relative path).
19
+ - [Fixed] Fix issue where `Set typing_speed` wasn't recognized.
20
+ - [Fixed] Fix issue where `Set shell` wasn't recognized.
21
+
22
+ ## v0.0.5
23
+
24
+ - [Changed] Add newline to multiline strings if they don't end with one.
25
+ - [Fixed] Ensure multiline strings are passed as the argument.
26
+
14
27
  ## v0.0.4
15
28
 
16
29
  - [Fixed] Fix how Thor handle defaults for arrays.
data/README.md CHANGED
@@ -109,6 +109,11 @@ $ echo "Type 'echo \"it works with stdin too\"'\nEnter\nSleep 5" | \
109
109
  info Finished in 11.92s
110
110
  ```
111
111
 
112
+ > [!TIP]
113
+ >
114
+ > Notice that when using `--working-dir`, all path references will be relative
115
+ > to the working directory, including `--output-path`.
116
+
112
117
  ### Output formats
113
118
 
114
119
  - When exporting videos, you can choose between `.mp4`, `.webm` or `.avi`.
data/lib/demo_tape/cli.rb CHANGED
@@ -13,6 +13,10 @@ module DemoTape
13
13
  end
14
14
 
15
15
  desc "run PATH", "Runs a demo tape"
16
+ option :working_dir,
17
+ type: :string,
18
+ desc: "Working directory to run the commands in",
19
+ default: Dir.pwd
16
20
  option :typing_speed,
17
21
  type: :string,
18
22
  default: "50ms",
@@ -158,7 +162,9 @@ module DemoTape
158
162
  content = File.read(file_path)
159
163
  end
160
164
 
161
- Runner.new(file_path:, content:, thor: shell, options:).run
165
+ Dir.chdir(options.working_dir) do
166
+ Runner.new(file_path:, content:, thor: shell, options:).run
167
+ end
162
168
  end
163
169
 
164
170
  desc "themes", "Lists available built-in themes"
@@ -268,7 +268,7 @@ module DemoTape
268
268
  duration = token.value[:raw].to_s.strip
269
269
  duration = "#{duration}s" if token.value[:unit].to_s.strip == ""
270
270
  values << thor.set_color(duration, :cyan)
271
- when Token::String
271
+ when Token::String, Token::MultilineString
272
272
  values << thor.set_color(token.raw, :yellow)
273
273
  when Token::Operator
274
274
  values << thor.set_color(token.value, :white)
@@ -266,8 +266,18 @@ module DemoTape
266
266
  compute_at_duration!(tokens, options)
267
267
 
268
268
  # Find the string/value argument
269
- string_token = tokens.find(&:string?)
270
- args = string_token ? string_token.value : ""
269
+ string_token = tokens.find(&:string?) ||
270
+ tokens.find(&:multiline_string?)
271
+
272
+ args = case string_token
273
+ when Token::String
274
+ string_token.value
275
+ when Token::MultilineString
276
+ text = string_token.value
277
+ text.end_with?("\n") ? text : "#{text}\n"
278
+ else
279
+ ""
280
+ end
271
281
 
272
282
  # For Sleep, Wait - check for duration/number
273
283
  if %w[
@@ -335,7 +335,8 @@ module DemoTape
335
335
 
336
336
  # Set attribute DURATION
337
337
  rules.push identifier("Set") +
338
- identifier("loop_delay", "run_sleep", "run_enter_delay") +
338
+ identifier("loop_delay", "run_sleep", "run_enter_delay",
339
+ "typing_speed") +
339
340
  duration
340
341
 
341
342
  # Set attribute BOOLEAN
@@ -347,12 +348,12 @@ module DemoTape
347
348
  rules.push identifier("Set") +
348
349
  identifier("width", "height", "cursor_width", "font_size",
349
350
  "padding", "margin", "loop_delay", "line_height",
350
- "border_radius") +
351
+ "border_radius", "typing_speed") +
351
352
  number
352
353
 
353
354
  # Set attribute STRING
354
355
  rules.push identifier("Set") +
355
- identifier("theme", "font_family", "margin_fill") +
356
+ identifier("theme", "font_family", "margin_fill", "shell") +
356
357
  string
357
358
 
358
359
  # Set cursor_style STRING
@@ -31,9 +31,10 @@ module DemoTape
31
31
  end
32
32
 
33
33
  def fail_with(error)
34
- error = error.message if error.respond_to?(:message)
34
+ error_message = error
35
+ error_message = error.message if error.respond_to?(:message)
35
36
 
36
- thor.say_error "\nERROR: #{error}", :red
37
+ thor.say_error "\nERROR: #{error_message}", :red
37
38
  puts error.backtrace if error.respond_to?(:backtrace)
38
39
  exit 1
39
40
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DemoTape
4
- VERSION = "0.0.4"
4
+ VERSION = "0.0.6"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: demotape
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nando Vieira
@@ -691,10 +691,10 @@ metadata:
691
691
  rubygems_mfa_required: 'true'
692
692
  homepage_uri: https://github.com/fnando/demotape
693
693
  bug_tracker_uri: https://github.com/fnando/demotape/issues
694
- source_code_uri: https://github.com/fnando/demotape/tree/v0.0.4
695
- changelog_uri: https://github.com/fnando/demotape/tree/v0.0.4/CHANGELOG.md
696
- documentation_uri: https://github.com/fnando/demotape/tree/v0.0.4/README.md
697
- license_uri: https://github.com/fnando/demotape/tree/v0.0.4/LICENSE.md
694
+ source_code_uri: https://github.com/fnando/demotape/tree/v0.0.6
695
+ changelog_uri: https://github.com/fnando/demotape/tree/v0.0.6/CHANGELOG.md
696
+ documentation_uri: https://github.com/fnando/demotape/tree/v0.0.6/README.md
697
+ license_uri: https://github.com/fnando/demotape/tree/v0.0.6/LICENSE.md
698
698
  rdoc_options: []
699
699
  require_paths:
700
700
  - lib