planter-cli 3.0.1 → 3.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.gitmodules +3 -0
  4. data/CHANGELOG.md +10 -0
  5. data/README.md +5 -3
  6. data/bin/plant +1 -1
  7. data/docker/Dockerfile +2 -4
  8. data/docker/Dockerfile-2.6 +3 -5
  9. data/docker/Dockerfile-2.7 +2 -4
  10. data/docker/Dockerfile-3.0 +2 -3
  11. data/docker/Dockerfile-3.3 +11 -0
  12. data/docker/sources.list +11 -0
  13. data/lib/planter/filelist.rb +5 -4
  14. data/lib/planter/plant.rb +3 -3
  15. data/lib/planter/prompt.rb +5 -5
  16. data/lib/planter/string.rb +22 -0
  17. data/lib/planter/tag.rb +39 -2
  18. data/lib/planter/version.rb +1 -1
  19. data/lib/planter.rb +30 -17
  20. data/lib/tty-spinner/.editorconfig +9 -0
  21. data/lib/tty-spinner/.github/FUNDING.yml +1 -0
  22. data/lib/tty-spinner/.github/ISSUE_TEMPLATE/BUG_REPORT.md +31 -0
  23. data/lib/tty-spinner/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md +23 -0
  24. data/lib/tty-spinner/.github/ISSUE_TEMPLATE/config.yml +5 -0
  25. data/lib/tty-spinner/.github/PULL_REQUEST_TEMPLATE.md +19 -0
  26. data/lib/tty-spinner/.github/workflows/ci.yml +59 -0
  27. data/lib/tty-spinner/.gitignore +14 -0
  28. data/lib/tty-spinner/.rspec +2 -0
  29. data/lib/tty-spinner/.rubocop.yml +78 -0
  30. data/lib/tty-spinner/CHANGELOG.md +151 -0
  31. data/lib/tty-spinner/CODE_OF_CONDUCT.md +132 -0
  32. data/lib/tty-spinner/Gemfile +17 -0
  33. data/lib/tty-spinner/LICENSE.txt +22 -0
  34. data/lib/tty-spinner/README.md +581 -0
  35. data/lib/tty-spinner/Rakefile +10 -0
  36. data/lib/tty-spinner/appveyor.yml +33 -0
  37. data/lib/tty-spinner/bin/console +14 -0
  38. data/lib/tty-spinner/bin/setup +8 -0
  39. data/lib/tty-spinner/demo.gif +0 -0
  40. data/lib/tty-spinner/examples/auto_spin.rb +10 -0
  41. data/lib/tty-spinner/examples/basic.rb +10 -0
  42. data/lib/tty-spinner/examples/clear.rb +11 -0
  43. data/lib/tty-spinner/examples/color.rb +14 -0
  44. data/lib/tty-spinner/examples/error.rb +11 -0
  45. data/lib/tty-spinner/examples/formats.rb +13 -0
  46. data/lib/tty-spinner/examples/hide_cursor.rb +14 -0
  47. data/lib/tty-spinner/examples/log.rb +13 -0
  48. data/lib/tty-spinner/examples/multi/basic.rb +15 -0
  49. data/lib/tty-spinner/examples/multi/basic_top_level.rb +15 -0
  50. data/lib/tty-spinner/examples/multi/custom_style.rb +28 -0
  51. data/lib/tty-spinner/examples/multi/files.rb +16 -0
  52. data/lib/tty-spinner/examples/multi/jobs.rb +11 -0
  53. data/lib/tty-spinner/examples/multi/multi.rb +19 -0
  54. data/lib/tty-spinner/examples/multi/multi_top_level.rb +20 -0
  55. data/lib/tty-spinner/examples/multi/pause.rb +28 -0
  56. data/lib/tty-spinner/examples/multi/threaded.rb +30 -0
  57. data/lib/tty-spinner/examples/pause.rb +24 -0
  58. data/lib/tty-spinner/examples/run.rb +20 -0
  59. data/lib/tty-spinner/examples/success.rb +11 -0
  60. data/lib/tty-spinner/examples/threaded.rb +13 -0
  61. data/lib/tty-spinner/examples/update.rb +13 -0
  62. data/lib/tty-spinner/lib/tty/spinner/formats.rb +274 -0
  63. data/lib/tty-spinner/lib/tty/spinner/multi.rb +352 -0
  64. data/lib/tty-spinner/lib/tty/spinner/version.rb +7 -0
  65. data/lib/tty-spinner/lib/tty/spinner.rb +604 -0
  66. data/lib/tty-spinner/lib/tty-spinner.rb +2 -0
  67. data/lib/tty-spinner/spec/spec_helper.rb +52 -0
  68. data/lib/tty-spinner/spec/unit/auto_spin_spec.rb +25 -0
  69. data/lib/tty-spinner/spec/unit/clear_spec.rb +16 -0
  70. data/lib/tty-spinner/spec/unit/error_spec.rb +53 -0
  71. data/lib/tty-spinner/spec/unit/events_spec.rb +35 -0
  72. data/lib/tty-spinner/spec/unit/formats_spec.rb +9 -0
  73. data/lib/tty-spinner/spec/unit/frames_spec.rb +31 -0
  74. data/lib/tty-spinner/spec/unit/hide_cursor_spec.rb +51 -0
  75. data/lib/tty-spinner/spec/unit/job_spec.rb +12 -0
  76. data/lib/tty-spinner/spec/unit/join_spec.rb +10 -0
  77. data/lib/tty-spinner/spec/unit/log_spec.rb +60 -0
  78. data/lib/tty-spinner/spec/unit/multi/auto_spin_spec.rb +32 -0
  79. data/lib/tty-spinner/spec/unit/multi/error_spec.rb +107 -0
  80. data/lib/tty-spinner/spec/unit/multi/line_inset_spec.rb +57 -0
  81. data/lib/tty-spinner/spec/unit/multi/on_spec.rb +11 -0
  82. data/lib/tty-spinner/spec/unit/multi/register_spec.rb +46 -0
  83. data/lib/tty-spinner/spec/unit/multi/spin_spec.rb +101 -0
  84. data/lib/tty-spinner/spec/unit/multi/stop_spec.rb +95 -0
  85. data/lib/tty-spinner/spec/unit/multi/success_spec.rb +108 -0
  86. data/lib/tty-spinner/spec/unit/new_spec.rb +25 -0
  87. data/lib/tty-spinner/spec/unit/pause_spec.rb +43 -0
  88. data/lib/tty-spinner/spec/unit/reset_spec.rb +19 -0
  89. data/lib/tty-spinner/spec/unit/run_spec.rb +30 -0
  90. data/lib/tty-spinner/spec/unit/spin_spec.rb +117 -0
  91. data/lib/tty-spinner/spec/unit/stop_spec.rb +88 -0
  92. data/lib/tty-spinner/spec/unit/success_spec.rb +53 -0
  93. data/lib/tty-spinner/spec/unit/tty_spec.rb +8 -0
  94. data/lib/tty-spinner/spec/unit/update_spec.rb +85 -0
  95. data/lib/tty-spinner/tasks/console.rake +11 -0
  96. data/lib/tty-spinner/tasks/coverage.rake +11 -0
  97. data/lib/tty-spinner/tasks/spec.rake +29 -0
  98. data/lib/tty-spinner/tty-spinner.gemspec +36 -0
  99. data/scripts/runtests.sh +1 -1
  100. data/spec/cli_spec.rb +27 -0
  101. data/spec/spec_helper.rb +26 -0
  102. data/spec/templates/test/_planter.yml +3 -6
  103. data/src/_README.md +5 -3
  104. metadata +86 -2
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ begin
4
+ require "rspec/core/rake_task"
5
+
6
+ desc "Run all specs"
7
+ RSpec::Core::RakeTask.new(:spec) do |task|
8
+ task.pattern = "spec/{unit,integration}{,/*/**}/*_spec.rb"
9
+ end
10
+
11
+ namespace :spec do
12
+ desc "Run unit specs"
13
+ RSpec::Core::RakeTask.new(:unit) do |task|
14
+ task.pattern = "spec/unit{,/*/**}/*_spec.rb"
15
+ end
16
+
17
+ desc "Run integration specs"
18
+ RSpec::Core::RakeTask.new(:integration) do |task|
19
+ task.pattern = "spec/integration{,/*/**}/*_spec.rb"
20
+ end
21
+ end
22
+
23
+ rescue LoadError
24
+ %w[spec spec:unit spec:integration].each do |name|
25
+ task name do
26
+ $stderr.puts "In order to run #{name}, do `gem install rspec`"
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/tty/spinner/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "tty-spinner"
7
+ spec.version = TTY::Spinner::VERSION
8
+ spec.authors = ["Piotr Murach"]
9
+ spec.email = ["piotr@piotrmurach.com"]
10
+ spec.summary = %q{A terminal spinner for tasks that have non-deterministic time frame.}
11
+ spec.description = %q{A terminal spinner for tasks that have non-deterministic time frame.}
12
+ spec.homepage = "https://ttytoolkit.org"
13
+ spec.license = "MIT"
14
+ if spec.respond_to?(:metadata=)
15
+ spec.metadata = {
16
+ "allowed_push_host" => "https://rubygems.org",
17
+ "bug_tracker_uri" => "https://github.com/piotrmurach/tty-spinner/issues",
18
+ "changelog_uri" => "https://github.com/piotrmurach/tty-spinner/blob/master/CHANGELOG.md",
19
+ "documentation_uri" => "https://www.rubydoc.info/gems/tty-spinner",
20
+ "funding_uri" => "https://github.com/sponsors/piotrmurach",
21
+ "homepage_uri" => spec.homepage,
22
+ "rubygems_mfa_required" => "true",
23
+ "source_code_uri" => "https://github.com/piotrmurach/tty-spinner"
24
+ }
25
+ end
26
+ spec.files = Dir["lib/**/*"]
27
+ spec.extra_rdoc_files = Dir["README.md", "CHANGELOG.md", "LICENSE.txt"]
28
+ spec.bindir = "exe"
29
+ spec.require_paths = ["lib"]
30
+ spec.required_ruby_version = ">= 2.0.0"
31
+
32
+ spec.add_dependency "tty-cursor", "~> 0.7"
33
+
34
+ spec.add_development_dependency "rake"
35
+ spec.add_development_dependency "rspec", ">= 3.0"
36
+ end
data/scripts/runtests.sh CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/bin/bash
2
2
 
3
3
  cd /planter
4
- bundle install
4
+ bundle update
5
5
  rake test
data/spec/cli_spec.rb ADDED
@@ -0,0 +1,27 @@
1
+ require 'open3'
2
+ require 'spec_helper'
3
+
4
+ include PlanterHelpers
5
+
6
+ describe 'CLI' do
7
+ TEST_DIR = File.join(File.dirname(__FILE__), 'test')
8
+
9
+ before do
10
+ FileUtils.rm_rf(TEST_DIR)
11
+ FileUtils.mkdir_p(TEST_DIR)
12
+ end
13
+
14
+ after do
15
+ FileUtils.rm_rf(TEST_DIR)
16
+ end
17
+
18
+ it 'displays help message' do
19
+ output, stderr, status = planter('--help')
20
+ expect(output).not_to be_empty
21
+ end
22
+
23
+ it 'plants a new project' do
24
+ output, stderr, status = planter('--defaults', "--in=#{TEST_DIR}", 'test')
25
+ expect(File.exist?(File.join(TEST_DIR, 'bollocks_and_beans.rtf'))).to be true
26
+ end
27
+ end
data/spec/spec_helper.rb CHANGED
@@ -24,3 +24,29 @@ RSpec.configure do |c|
24
24
  end
25
25
  c.add_formatter 'd'
26
26
  end
27
+
28
+ require 'open3'
29
+ require 'time'
30
+
31
+ module PlanterHelpers
32
+ PLANTER_EXEC = File.join(File.dirname(__FILE__), '..', 'bin', 'plant')
33
+
34
+ def planter_with_env(env, *args, stdin: nil)
35
+ pread(env, 'bundle', 'exec', PLANTER_EXEC, "--base-dir=#{File.dirname(__FILE__)}", *args, stdin: stdin)
36
+ end
37
+
38
+ def pread(env, *cmd, stdin: nil)
39
+ out, err, status = Open3.capture3(env, *cmd, stdin_data: stdin)
40
+ unless status.success?
41
+ raise [
42
+ "Error (#{status}): #{cmd.inspect} failed", "STDOUT:", out.inspect, "STDERR:", err.inspect
43
+ ].join("\n")
44
+ end
45
+
46
+ [out, err, status]
47
+ end
48
+
49
+ def planter(*args, stdin: nil)
50
+ planter_with_env({}, *args, stdin: stdin)
51
+ end
52
+ end
@@ -1,12 +1,9 @@
1
1
  ---
2
2
  variables:
3
- - key: var_key
3
+ - key: project
4
4
  prompt: CLI Prompt
5
- type: "[string, float, integer, number, date]"
6
- value: "(optional, for date type can be today, time, now, etc., empty to prompt)"
7
- default: "(optional default value, leave empty or remove key for no default)"
8
- min: "(optional, for number type set a minimum value)"
9
- max: "(optional, for number type set a maximum value)"
5
+ type: string
6
+ default: "bollocks and beans"
10
7
  git_init: false
11
8
  files:
12
9
  "*.tmp": ignore
data/src/_README.md CHANGED
@@ -32,9 +32,9 @@ git_init: false
32
32
  preserve_tags: true
33
33
  ```
34
34
 
35
- ### Scripts.
35
+ ### Scripts
36
36
 
37
- Scripts for execution after planting can be stored in `~/.config/planter/scripts` and referenced by filename only. Alternatively, scripts may be stored within a template in a `_scritps` subfolder.
37
+ Scripts for execution after planting can be stored in `~/.config/planter/scripts` and referenced by filename only. Alternatively, scripts may be stored within a template in a `_scripts` subfolder.
38
38
 
39
39
  Scripts can be executable files in any language, and receive the template directory and the planted directory as arguments $1 and $2.
40
40
 
@@ -79,6 +79,8 @@ files:
79
79
  "%%title%%.md": overwrite
80
80
  ```
81
81
 
82
+ Filenames can include wildcards (`*`, `?`), and Bash-style globbing (`[0-9]`, `[a-z]`, `{one,two,three}`).
83
+
82
84
  If `merge` is specified, then the source file is scanned for merge comments and those are merged if they don't exist in the copied/existing file. If no merge comments are defined, then the entire contents of the source file are appended to the destination file (unless the file already matches the source). Merge comments start with `merge` and end with `/merge` and can have any comment syntax preceding them, for example:
83
85
 
84
86
  ```
@@ -109,7 +111,7 @@ replacements:
109
111
  "(main|app)\.js": "%%script:lower%%.js"
110
112
  ```
111
113
 
112
- Replacements are performed on both file/directory names and file contents.
114
+ Replacements are performed on both file/directory names and file contents. This is especially handy when the source of the plant is a Git repo, allowing the replacement of elements without having to create %%templated%% filenames and contents.
113
115
 
114
116
  ### Finder Tags
115
117
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: planter-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.1
4
+ version: 3.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Terpstra
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-08-31 00:00:00.000000000 Z
11
+ date: 2024-09-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bump
@@ -342,6 +342,7 @@ extra_rdoc_files: []
342
342
  files:
343
343
  - ".editorconfig"
344
344
  - ".gitignore"
345
+ - ".gitmodules"
345
346
  - ".irbrc"
346
347
  - ".rspec"
347
348
  - ".rubocop.yml"
@@ -359,8 +360,10 @@ files:
359
360
  - docker/Dockerfile-2.6
360
361
  - docker/Dockerfile-2.7
361
362
  - docker/Dockerfile-3.0
363
+ - docker/Dockerfile-3.3
362
364
  - docker/bash_profile
363
365
  - docker/inputrc
366
+ - docker/sources.list
364
367
  - lib/.rubocop.yml
365
368
  - lib/planter.rb
366
369
  - lib/planter/array.rb
@@ -377,10 +380,90 @@ files:
377
380
  - lib/planter/symbol.rb
378
381
  - lib/planter/tag.rb
379
382
  - lib/planter/version.rb
383
+ - lib/tty-spinner/.editorconfig
384
+ - lib/tty-spinner/.github/FUNDING.yml
385
+ - lib/tty-spinner/.github/ISSUE_TEMPLATE/BUG_REPORT.md
386
+ - lib/tty-spinner/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md
387
+ - lib/tty-spinner/.github/ISSUE_TEMPLATE/config.yml
388
+ - lib/tty-spinner/.github/PULL_REQUEST_TEMPLATE.md
389
+ - lib/tty-spinner/.github/workflows/ci.yml
390
+ - lib/tty-spinner/.gitignore
391
+ - lib/tty-spinner/.rspec
392
+ - lib/tty-spinner/.rubocop.yml
393
+ - lib/tty-spinner/CHANGELOG.md
394
+ - lib/tty-spinner/CODE_OF_CONDUCT.md
395
+ - lib/tty-spinner/Gemfile
396
+ - lib/tty-spinner/LICENSE.txt
397
+ - lib/tty-spinner/README.md
398
+ - lib/tty-spinner/Rakefile
399
+ - lib/tty-spinner/appveyor.yml
400
+ - lib/tty-spinner/bin/console
401
+ - lib/tty-spinner/bin/setup
402
+ - lib/tty-spinner/demo.gif
403
+ - lib/tty-spinner/examples/auto_spin.rb
404
+ - lib/tty-spinner/examples/basic.rb
405
+ - lib/tty-spinner/examples/clear.rb
406
+ - lib/tty-spinner/examples/color.rb
407
+ - lib/tty-spinner/examples/error.rb
408
+ - lib/tty-spinner/examples/formats.rb
409
+ - lib/tty-spinner/examples/hide_cursor.rb
410
+ - lib/tty-spinner/examples/log.rb
411
+ - lib/tty-spinner/examples/multi/basic.rb
412
+ - lib/tty-spinner/examples/multi/basic_top_level.rb
413
+ - lib/tty-spinner/examples/multi/custom_style.rb
414
+ - lib/tty-spinner/examples/multi/files.rb
415
+ - lib/tty-spinner/examples/multi/jobs.rb
416
+ - lib/tty-spinner/examples/multi/multi.rb
417
+ - lib/tty-spinner/examples/multi/multi_top_level.rb
418
+ - lib/tty-spinner/examples/multi/pause.rb
419
+ - lib/tty-spinner/examples/multi/threaded.rb
420
+ - lib/tty-spinner/examples/pause.rb
421
+ - lib/tty-spinner/examples/run.rb
422
+ - lib/tty-spinner/examples/success.rb
423
+ - lib/tty-spinner/examples/threaded.rb
424
+ - lib/tty-spinner/examples/update.rb
425
+ - lib/tty-spinner/lib/tty-spinner.rb
426
+ - lib/tty-spinner/lib/tty/spinner.rb
427
+ - lib/tty-spinner/lib/tty/spinner/formats.rb
428
+ - lib/tty-spinner/lib/tty/spinner/multi.rb
429
+ - lib/tty-spinner/lib/tty/spinner/version.rb
430
+ - lib/tty-spinner/spec/spec_helper.rb
431
+ - lib/tty-spinner/spec/unit/auto_spin_spec.rb
432
+ - lib/tty-spinner/spec/unit/clear_spec.rb
433
+ - lib/tty-spinner/spec/unit/error_spec.rb
434
+ - lib/tty-spinner/spec/unit/events_spec.rb
435
+ - lib/tty-spinner/spec/unit/formats_spec.rb
436
+ - lib/tty-spinner/spec/unit/frames_spec.rb
437
+ - lib/tty-spinner/spec/unit/hide_cursor_spec.rb
438
+ - lib/tty-spinner/spec/unit/job_spec.rb
439
+ - lib/tty-spinner/spec/unit/join_spec.rb
440
+ - lib/tty-spinner/spec/unit/log_spec.rb
441
+ - lib/tty-spinner/spec/unit/multi/auto_spin_spec.rb
442
+ - lib/tty-spinner/spec/unit/multi/error_spec.rb
443
+ - lib/tty-spinner/spec/unit/multi/line_inset_spec.rb
444
+ - lib/tty-spinner/spec/unit/multi/on_spec.rb
445
+ - lib/tty-spinner/spec/unit/multi/register_spec.rb
446
+ - lib/tty-spinner/spec/unit/multi/spin_spec.rb
447
+ - lib/tty-spinner/spec/unit/multi/stop_spec.rb
448
+ - lib/tty-spinner/spec/unit/multi/success_spec.rb
449
+ - lib/tty-spinner/spec/unit/new_spec.rb
450
+ - lib/tty-spinner/spec/unit/pause_spec.rb
451
+ - lib/tty-spinner/spec/unit/reset_spec.rb
452
+ - lib/tty-spinner/spec/unit/run_spec.rb
453
+ - lib/tty-spinner/spec/unit/spin_spec.rb
454
+ - lib/tty-spinner/spec/unit/stop_spec.rb
455
+ - lib/tty-spinner/spec/unit/success_spec.rb
456
+ - lib/tty-spinner/spec/unit/tty_spec.rb
457
+ - lib/tty-spinner/spec/unit/update_spec.rb
458
+ - lib/tty-spinner/tasks/console.rake
459
+ - lib/tty-spinner/tasks/coverage.rake
460
+ - lib/tty-spinner/tasks/spec.rake
461
+ - lib/tty-spinner/tty-spinner.gemspec
380
462
  - planter-cli.gemspec
381
463
  - scripts/deploy.rb
382
464
  - scripts/runtests.sh
383
465
  - spec/.rubocop.yml
466
+ - spec/cli_spec.rb
384
467
  - spec/config.yml
385
468
  - spec/planter.yml
386
469
  - spec/planter/array_spec.rb
@@ -430,6 +513,7 @@ specification_version: 4
430
513
  summary: Plant files and directories using templates
431
514
  test_files:
432
515
  - spec/.rubocop.yml
516
+ - spec/cli_spec.rb
433
517
  - spec/config.yml
434
518
  - spec/planter.yml
435
519
  - spec/planter/array_spec.rb