|
1 | | -require "byebug" |
2 | | -require 'bashly' |
| 1 | +require 'byebug' |
| 2 | +require 'bashly/version' |
3 | 3 | require_relative 'support/runfile/example' |
4 | 4 |
|
5 | | -title "Bashly Developer Toolbelt" |
6 | | -summary "Runfile tasks for building the Bashly gem" |
7 | | -version Bashly::VERSION |
| 5 | +title 'Bashly Developer Toolbelt' |
| 6 | +summary 'Runfile tasks for building the Bashly gem' |
8 | 7 |
|
9 | | -import_gem 'runfile-tasks/gem', gemname: 'bashly' |
| 8 | +import_gem 'runfile-tasks/gem' |
10 | 9 | import_gem 'runfile-tasks/docker', image: 'dannyben/bashly', version: Bashly::VERSION |
11 | | -import 'support/runfile/examples' |
12 | | -import 'support/runfile/debug' |
13 | | - |
14 | | -help "Run shellcheck on all examples" |
15 | | -action :shellcheck do |
16 | | - allowed_skips = 1 |
17 | | - Example.executables.each do |example| |
18 | | - if File.exist? example |
19 | | - success = system "shellcheck #{example}" |
20 | | - color = success ? 'g' : 'r' |
21 | | - say "- shellcheck #{color}`#{example}`" |
22 | | - exit 1 unless success |
23 | | - else |
24 | | - say "- skip c`#{example}`" |
25 | | - allowed_skips -= 1 |
26 | | - if allowed_skips < 0 |
27 | | - say "- aborted: too many skips" |
28 | | - exit 1 |
29 | | - end |
30 | | - end |
31 | | - end |
32 | | -end |
33 | | - |
34 | | -help "Run shfmt checks on all examples" |
35 | | -action :shfmt do |
36 | | - allowed_skips = 2 |
37 | | - Example.executables.each do |example| |
38 | | - if example == 'examples/heredoc/cli' || !File.exist?(example) |
39 | | - say "- skip c`#{example}`" |
40 | | - allowed_skips -= 1 |
41 | | - if allowed_skips < 0 |
42 | | - say "- aborted: too many skips" |
43 | | - exit 1 |
44 | | - end |
45 | | - next |
46 | | - end |
47 | | - |
48 | | - success = system "shfmt -d -i 2 -ci #{example}" |
49 | | - color = success ? 'g' : 'r' |
50 | | - say "- shfmt #{color}`#{example}`" |
51 | | - exit 1 unless success |
52 | | - end |
53 | | -end |
54 | | - |
55 | | -help "Run json-schema checks on all examples" |
56 | | -action :schema do |
57 | | - Example.all.each do |example| |
58 | | - file = example.yaml_path |
59 | | - command = "check-jsonschema --schemafile schema.json #{file}" |
60 | | - success = system command |
61 | | - color = success ? 'g' : 'r' |
62 | | - say "- check-jsonschema #{color}`#{example.dir}`" |
63 | | - exit 1 unless success |
64 | | - end |
65 | | -end |
66 | | - |
67 | | -help "Generate changelog and append old changelog" |
68 | | -action :changelog do |
69 | | - system "git changelog --save" |
70 | | - # append older changelog (prior to switching to git-changelog) |
71 | | - system "cat support/.changelog.old.md >> CHANGELOG.md" |
72 | | - |
73 | | - # Fix typos |
74 | | - File.write "CHANGELOG.md", File.read("CHANGELOG.md").gsub('repeatableflags', 'repeatable flags') |
75 | | -end |
| 10 | +import 'support/runfile/*' |
0 commit comments